www.webdeveloper.com
Results 1 to 3 of 3

Thread: select max day for each month?

  1. #1
    Join Date
    Jan 2006
    Posts
    1

    select max day for each month?

    Hi,
    I have a problem with a query to take records register different time in each month.
    I want to select from a table only the records register in a max date in each month with NAME = ? AND DATE BETWEEN ? AND ?.

    EX:
    DATA VALUE NAME
    30/12/2005 30,10 MARIO
    30/12/2005 22,30 LUIGI
    01/12/2005 50,45 MARIO
    23/11/2005 10,40 LUIGI
    20/11/2005 22,45 MARIO
    10/11/2005 11,34 MARIO
    09/11/2005 10,34 LUIGI
    ........
    10/02/2005 23,34 MARIO
    ........

    MY RESULT WOULD BE IF I REQUEST NAME='MARIO' AND DATA BETWEEN 01/11/2005 AND 31/12/2005 ORDER BY DATA:

    20/11/2005 22,45 MARIO
    30/12/2005 30,10 MARIO


    THANKS

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,936
    What DBMS are you using?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Dec 2006
    Posts
    1

    Use Group by

    Use Select query with group by month(control_date),year(control_date)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles