ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ODBC MS Query - comparing dates (https://www.excelbanter.com/excel-programming/426648-odbc-ms-query-comparing-dates.html)

JoeF

ODBC MS Query - comparing dates
 
Having trouble with SQL statement

table= loans
field_name=pay_date

I want to say WHERE loans.pay_date < TODAY I tried today(), sysdate,
CurrentDate nothing seems to work. Any help is appreciated.

Joe

RB Smissaert

ODBC MS Query - comparing dates
 
What database?
In Firebird and Interbase for example you can do:
WHERE loans.pay_date < 'TODAY'

RBS


"JoeF" wrote in message
...
Having trouble with SQL statement

table= loans
field_name=pay_date

I want to say WHERE loans.pay_date < TODAY I tried today(), sysdate,
CurrentDate nothing seems to work. Any help is appreciated.

Joe



JoeF

ODBC MS Query - comparing dates
 
Superbase. In Superbase I can use TODAY and it works fine. Problem is when I
insert SQL statement in MS Query I get various errors.
I tried yours and got the following error msg "Ivalid operand for operator:
<" Other messages include - "Expected Lexical element not found..", "Column
not found..." etc...

Thanks.

"RB Smissaert" wrote:

What database?
In Firebird and Interbase for example you can do:
WHERE loans.pay_date < 'TODAY'

RBS


"JoeF" wrote in message
...
Having trouble with SQL statement

table= loans
field_name=pay_date

I want to say WHERE loans.pay_date < TODAY I tried today(), sysdate,
CurrentDate nothing seems to work. Any help is appreciated.

Joe




RB Smissaert

ODBC MS Query - comparing dates
 
I don't know Superbase, but maybe you can do this:

WHERE loans.pay_date < (select TODAY from loans)

The other option is to use a variable and put the current date in that in
the right format, so you will get something like this:

"SELECT * FROM loans WHERE loans.pay_date < " & strCurrentDate


RBS



"JoeF" wrote in message
...
Superbase. In Superbase I can use TODAY and it works fine. Problem is
when I
insert SQL statement in MS Query I get various errors.
I tried yours and got the following error msg "Ivalid operand for
operator:
<" Other messages include - "Expected Lexical element not found..",
"Column
not found..." etc...

Thanks.

"RB Smissaert" wrote:

What database?
In Firebird and Interbase for example you can do:
WHERE loans.pay_date < 'TODAY'

RBS


"JoeF" wrote in message
...
Having trouble with SQL statement

table= loans
field_name=pay_date

I want to say WHERE loans.pay_date < TODAY I tried today(), sysdate,
CurrentDate nothing seems to work. Any help is appreciated.

Joe





[email protected][_2_]

ODBC MS Query - comparing dates
 
Try:

WHERE loans.pay_date < GETDATE()


All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com