Current date in SQL query

TjS

Registered User.
Local time
Today, 23:31
Joined
Jul 18, 2007
Messages
126
Maybe a simple question, but i do not know how to put the current date in the WHERE clause of a SQL query.

The query i have so far:

Code:
select [table1].*, [table2].*  from [table1], [table2] where [table1].[field] = [table2].[field] and [table1].[enddate] is null

After this there has to be something like
Code:
and [table1].[begindate] < [Date] (where [date] is the expression)

I know that with Date() or Now() the expression can be made, but i do not know how, please advise..

Thanks in advance
 
use the date function as you wrote it. something like:
WHERE [table1].[begindate] < Date()

- create your query in the query builder then View->SQL View
 
SQL query; date function

Code:
WHERE [table1].[begindate] < Date()

I used the Date() function, but i get an error #936 (missing expression);
(it is a passtrhough query by the way).
when i do not apply the
Code:
 and [table1].[begindate] < Date()
after the Select....From... clause then the datasheet does appear with the records.

Somehow i miss something in my expression maybe?
 
Weird; as passthrough query not working, as 'regular' query IS working

I have build the query again as a regular query, linked the tables and started the query.

Then the query IS working.

I don't understand why the expression is not working when the query is a passthrough query? (is the query which is executed on the database (oracle database) with a passthrough done in access or in oracle for that matter? If so, then i need of course the Date() in PL/SQL language, however, i thought these two languages were (almost) the same (when talking about the Date() function)....

Please help me out (again :) )
 
Found it

the function didn't had to be Date() but (PL/SQL Language) current_date; now it's working fine!

Thanks for the help!
 

Users who are viewing this thread

Back
Top Bottom