How to test for dates earlier than the current date in SQLite

ceekay

New Member
I'm using SQLite to store some data and I am aware that a date object cannot be stored an SQLite database so I'm using a string.My problem is that I want to check for the earliest date that is the table. So if there are 2 cards one which was 01/04/2013 and 04/05/2013 I want to recognise that 01/04/2013 is the earlier date and return that row. So far I have come up with 2 solutions:Multiple queries to the DBI have been able to implement a successful solution that will iterate through the database and decrease a date object by 1 which is then used as a string to match the date. The issue is that the database may need to be queried 100 times before it finds the earliest date. Is it bad practice to do it this way?Iterative through the result setAnother possibility is to iterate through a result set of all the flashcards in the table. However, this would involve 2 loops, one to iterate over each row in the table which would be inside a loop that would decrease the date by 1.I feel that both of these are not great solutions. I wonder if someone could help me achieve this in a more efficient manner?
 
Back
Top