Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sql stament with date filed

Hi Forum

I have a sql statement. I have problems with date field [doc-fec] . When I execute the script.



SQL SELECT emp-cod, doc-fec
FROM nom_historic
wHERE (cpt-liq = 105 Or cpt-liq =125) And emp-cod = '57147' And [doc-fec] >= '22/08/2009';

How can i apply this condition ?

Thanks.

4 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

it depends on your database and on the way the database stores dates. Your syntax needs to match your DB SQL syntax - the same way you'd write a query directly on your database...

prieper
Master II
Master II

Believe that the usual SQL-syntax for dates is MM/DD/YYYY, thus would try with a WHERE-clause like
.... >='08/22/2009'.

Peter

Not applicable
Author

On SQL Server, use CONVERT:

[doc-fec] >= CONVERT(DateTime, '22/08/2009', 103)

where 103 is the code for dd/mm/yyyy formatting.

Not applicable
Author

Hi Forum

Thanks for yours answers. These help me to find the correct sintax:



sELECT emp-cod, doc-fec
fROM nom_his
wHERE (cpt-liq = 105 Or cpt-liq =125) And emp-cod = '57147' And doc-fec >= DATE('22/08/2009');

I´m working with Progress Database.