02 April,2014 by Tom Collins
Question:Do you know how to write a query in DB2 that would display records based on the last month eg. Take todays date and then display last 31 days ? In other words, I need to subtract some days from a timestamp
Answer: Without actual details I can’t supply a specific query, but I can share with you a pattern, allowing you to apply in your query.
The basic concept:
CURRENT_TIMESTAMP - 31 DAYS
This example query will return the date from 31 days ago
db2 "select date(current timestamp – 31 days) from sysibm.sysdummy1"
How you construct the statement will depend on the column used to store the dates
Last time DB2 REORG was executed
DB2 – 10 Top Skills for Architects
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |