Solved

SQL query to pull today's transactions

Posted on 2013-02-07
4
167 Views
Last Modified: 2013-02-07
I have an access database that logs history using the =Now() function into a field called TimeStamp.  I'd like a simple query to pull all records with a certain date, but since each record also has a time attached, all my results return blank.

I'm thinking ...

SELECT * from tblHistory WHERE TimeStamp = "02/07/13"

But the recordset returns empty because the underlying data is ...

TimeStamp
02/07/2013 3:58:01 PM
02/07/2013 3:58:15 PM
02/07/2013 3:58:55 PM
02/07/2013 3:59:01 PM
02/07/2013 3:56:30 PM


HELP?!
0
Comment
Question by:callstate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Expert Comment

by:David Kroll
ID: 38865129
try

select * from tblhistory where convert(varchar, timestamp, 101) = "02/07/13"

EDIT:

I failed to see that you're in access, so you might have to try this:

select * from tblhistory
WHERE timestamp >= #2013-02-07# and Licenses.Entereddate < #2013-02-08#
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38865315
Since it is Access, use:

SELECT * from tblHistory
WHERE DateValue([TimeStamp]) = Date()
0
 

Author Closing Comment

by:callstate
ID: 38865404
Perfect!
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38865443
BTW,

I would get out of the habit of calling it a [TimeStamp] as that has a very specific meaning in SQL Server.  I use [LastModified]
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
2 IIF's in Access query 25 47
SQL Server group with two values 4 41
SQL query and VBA 5 55
SQL Query Syntax error after > 11 41
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question