Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
If you can't
login and post questions or you are having trouble viewing forum posts:
Click Here
|
Callback
Support |
If you live in USA, UK, Canada, Australia or New
Zealand, you can leave us details on your question and request us to call you back and discuss
them with you personally (charges apply). |
Click Here
|
Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
|
Referencing TODAY's date minus 30 days in a WHERE clause? |
Author |
Message |
|
Posted : 2006-04-19 05:29:02 |
I'm wanting to write some select statements on both InvoiceLine and SalesReceiptLine that returns all records dated WITHIN the past 30 days, relative to whatever TODAY is. I'm very familiar with Microsoft SQL syntax, and would normally say...
WHERE TxnDate >= getdate()-30
How can I reference "30 days ago" using the QODBC driver?
TIA! |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-04-19 08:48:24 |
In QODBC, the function CURDATE() – Returns the current computer system date as a date value.
For example, for Today, April 18, 2006, when the following query :-
SELECT {fn CURDATE()} as Today, ({fn CURDATE()}-30) as "30 Days Ago", TxnDate, RefNumber, InvoiceLineDesc FROM invoiceline WHERE TxnDate >= ({fn CURDATE()}-30)
is run in VB Demo the results were:
See: What Time and Date Functions can be used with QODBC? for more. |
|
|
|
|