Solved

SQL query to pull today's transactions

Posted on 2013-02-07
4
163 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
  • 2
4 Comments
 
LVL 11

Expert Comment

by:David Kroll
Comment Utility
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
Comment Utility
Since it is Access, use:

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

Author Closing Comment

by:callstate
Comment Utility
Perfect!
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now