Trying to run SQL Date query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Riaan
    New Member
    • Aug 2006
    • 6

    Trying to run SQL Date query

    Hi There,

    I am a newby with SQL and I am trying to run a query on a date/time field. The query is for the previous date. I would like to create this as a criteria in a view, but not sure what the criteria should look like doing a previous day query.

    The test query I have done using SQL analyzer is (select * from mvs_store_all_d ata_time_change where mvs_creation_da te like '060801%').

    This returns the previous days data, but is hard coded and need the query to be used daily, for the previous date.

    Any can help? :).
  • cleaner7777
    New Member
    • Mar 2006
    • 7

    #2
    Not sure about which database you are using, but in DB2 I would execute something like:

    SELECT * FROM table WHERE creation_date = (CURRENT DATE - 1 DAY);

    Comment

    Working...