Sort by 2 Fields

Results 1 to 2 of 2

Thread: Sort by 2 Fields

  1. #1
    Join Date
    Dec 1969

    Default Sort by 2 Fields

    I Have a table Songs with fields: <BR>Song.Id, Song.Name, Song.DateInComing, Song.DateUpdated<BR><BR>I want one list by date Where both Song.DateInComing and Song.DateUpdated are listed in same row.<BR><BR>e.g.<BR><BR>Yesterday 2004/2/21 20:50:00 Updated<BR>Close your eyes 2004/2/21 20:49:00 InComing<BR>Yesterday 2004/2/21 20:45:00 InComing

  2. #2
    Join Date
    Dec 1969

    Default Have to use a UNION...

    SELECT Id, Name, DateIncoming AS theDate, &#039;InComing&#039; AS what FROM Songs<BR>UNION<BR>SELECT Id, Name, DateUpdated, &#039;Updated&#039; FROM Songs<BR>ORDER BY theDate DESC, Name<BR><BR>Note that only the field names from the *first* SELECT matter when grabbing the info via an ADODB.Recordset object.<BR><BR>

Posting Permissions

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