Results 1 to 4 of 4

Thread: Date

  1. #1
    Join Date
    Jan 2004
    Posts
    67

    Unanswered: Date

    I need to find out the Max Date of a Particular Year in a table.

    How do i do this

    Thanks
    Shankar

  2. #2
    Join Date
    Mar 2004
    Posts
    23
    How about:

    select max(date_col) from tbl where to_char(date_col,'RRRR') = '2004'

  3. #3
    Join Date
    Jan 2004
    Posts
    67

    Date...

    What happens if i dont have the Date as the input.

    suppose i have 15 records for year 2004 and 15 records for 2005 ..
    and so on...

    I need a query that can give me the Max date of that particular year
    for all the years that are there in the table

    Hope this is clear

    thanks
    shankar

  4. #4
    Join Date
    Mar 2004
    Posts
    23
    "for all the years that are there in the table"

    You neglected to mention this the first time.

    select to_char(date_col,'RRRR') yr, max(date_col) max_date
    from tbl
    group by to_char(date_col,'RRRR')
    order by yr

Posting Permissions

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