If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Get All Records from timestamp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-30-09, 03:13
dinjo_jo dinjo_jo is offline
Registered User
 
Join Date: May 2008
Posts: 34
Get All Records from timestamp

I need to retreive all records for todays date something like this

select *
from TABLEa
where A = ??


So A should match all data for todays date and ignore all time data
Reply With Quote
  #2 (permalink)  
Old 11-30-09, 03:47
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
What do you know about date/time/timestamp calculations on DB2?

Did you read this article?
DB2 Basics: Fun with Dates and Times

What did you tried? What result(or error) did you got from the trial?
Reply With Quote
  #3 (permalink)  
Old 11-30-09, 04:50
dinjo_jo dinjo_jo is offline
Registered User
 
Join Date: May 2008
Posts: 34
I'm totally from sybase dont know much on db2
I tried this and it works
where DATE(COLUMNA) = DATE('2009-11-28')

also for current date

where DATE(COLUMNA) = DATE(current date)

but how do i get a previous date record say something like this

DATE(current date) - 1
Reply With Quote
  #4 (permalink)  
Old 11-30-09, 06:00
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Try:

current date - 1 DAY



there is no need to use DATE() with current date
Reply With Quote
  #5 (permalink)  
Old 11-30-09, 06:22
dinjo_jo dinjo_jo is offline
Registered User
 
Join Date: May 2008
Posts: 34
Yeah this worked.Still learning DB2 ;-)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On