Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    USA
    Posts
    4

    Unanswered: Getting records based on the most current date

    We update data each night. As such "Yesterdays" items have the most current date on them. The table holds data for the entire month. I only need yesterdays records though, I need a where clause that will find the last business day or the highest / most current date in a date field, then only pull in records that match that date. I've toyed with Max(Date) but this isn't working. Any suggestions you have will be greatly appreciated.

    Thanks everyone.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Getting records based on the most current date

    Since you have posted in a DB2 forum I assume you use DB2 ...

    MAX(DATE-column) - what was the error with it ... did it say a syntax error ? what was it ? What was the SQL Query you used ?

    Which OS is your DB2 sitting on ? What version and what fixpack are you on ? From where (I mean command line, a java JDBC app, a MS Application, SPUFI, QMF..... ) did you try to execute the query ?

    Cheers
    Sathyaram

    Originally posted by Keith Cunningha
    We update data each night. As such "Yesterdays" items have the most current date on them. The table holds data for the entire month. I only need yesterdays records though, I need a where clause that will find the last business day or the highest / most current date in a date field, then only pull in records that match that date. I've toyed with Max(Date) but this isn't working. Any suggestions you have will be greatly appreciated.

    Thanks everyone.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Mar 2004
    Location
    USA
    Posts
    4

    Re: Getting records based on the most current date

    When I used MAX(DATECOLUMN) in the where clause I get an unexpected token error. It is saying it is hitting the end of statement, then says it is expecting <comp_op><qualifier><subquery The SQL state is 42601

    DB = DB2
    Operating system = Database: AIX, Desktop where this is running: W2K
    The Db is remote - we are leasing storage there so I dont' have version information. I'm running this from my reporting tool: Actuate V7, and also in Db2 connect - same message each time.

    Originally posted by sathyaram_s
    Since you have posted in a DB2 forum I assume you use DB2 ...

    MAX(DATE-column) - what was the error with it ... did it say a syntax error ? what was it ? What was the SQL Query you used ?

    Which OS is your DB2 sitting on ? What version and what fixpack are you on ? From where (I mean command line, a java JDBC app, a MS Application, SPUFI, QMF..... ) did you try to execute the query ?

    Cheers
    Sathyaram

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •