TODAY SQL query..........

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everyone,

I want to write (using the DBW) a reports that only shows records created
today, but I am at a loss as to what the SQL should be.

ANy help will be greatly apprectiated

Tia

Jonathan
 
It all depends on how you identify records created today. Do you have a
column in the table for it?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
Hi Kevin

Thanks for your quick reply

Yes - I have a column in the SQL table called "order_date" which is
populated from a hidden field on the input form so every time a user inputs
an order and submits it to the database the field "order_date" is
automatically populated by this hidden field with the current system date
 
Hi Jonathan,

Your SQL Server query would l9ok something like the following:

SELECT * FROM tableName WHERE DateDiff(d, order_date, GetDate()) = 0

What this does is subtract your date column from the current date
(GetDate()), using a Day as the interval (d). If the result is 0, the
order_date is from today.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Acces & SQL Server 1
What am I missing my my code??????? 3
New to SQL, new to forums 7
Sort order in DBW 4
Access stripping decimal places in query 1
Auto Refresh DRW 2
Text Area Mapping 4
PC Build Advice 5

Back
Top