Topic: Sql statement to display records based on a date field
Hi
I have an sqlite table that contains a date field with values like : '22/11/2014 2:16:37 μμ' (μμ stands for pm in greek)
I have a display grid that shows all the records from this table.
I want to be able to select a date period in months e.g. 24 and create an sql search statement that will display all records whose date is less than 24 months from now.
The table contains products in a warehouse and the date field corresponds to the product's storage date. I want to find out how many products are older that X days in storage from now.
For example: Form1.Tablegrid1.dbSQL:='SELECT * FROM "'+product_table+'" WHERE "Ημερομηνίαπροσθήκης" < "'+dateSearchString+'" ORDER BY "Feature:Μάρκα","Feature:Μοντέλο","Feature:;Έτος","Feature:ΕίδοςΑνταλλακτικού"';
This query works only for the '=' operator. When I use '>' or'<' it does not work correctly and returns wrong results.
Thank you