Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Location
    Auckland, New Zealand
    Posts
    11

    Unanswered: ordering by date part

    hi guys,

    i have a column 'viewed_last' that is a timestamp. in a query to determine the most views of an item in one day, i wish to order by this field but only the date part so the time becomes negligable.

    is this possible to do in sql?

    mike

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    try this --
    Code:
    ORDER BY DATEADD(D,DATEDIFF(D,'1969-07-20',viewed_last),'1969-07-20')
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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