www.webdeveloper.com
Results 1 to 2 of 2

Thread: Sorting times of day

  1. #1
    Join Date
    Oct 2008
    Location
    Chicago
    Posts
    1

    Sorting times of day

    We have a table, large, with date-time field for every day of the last few years. The date repeats when a new process fires to note the time. Each day contains LOTS of these incidents.

    The goal is to sort the date-time fields and aquire the latest occurance of the day for all the days in the range selected, say the year 2008. This MAX needs to be found for each day. The current SQL only returns one day for all the years with that one day's MAX.

    I've tried parsing out the date time but the conversions do more harm than good. In any event there should be a simple enough aggregate query to group the days and return only one day for each, with the MAX time.

    The tables are too big to move into Excel where sorting is a different animal.
    Thank you for your help.

    Plungerman

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    what if you group by the date part, using the date function?

    http://dev.mysql.com/doc/refman/5.0/...#function_date
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

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