SQL syntax question

  • I have this code on an .asp page:


       

      if intMemberId<>"" then

     

     

      strSql="select tblEvent.EventID as EventID,tblEvent.Event as Event,tblEventCategory.EventCategory as EventCategory,tblEvent.EventDate as EventDate,tblEvent.EventToDate from tblEvent,tblEventCategory where MemberId=" & intMemberId & _

        "and tblEvent.EventCategoryCode=tblEventCategory.EventCategoryCode"

     

      set RsRecords=GetRecords(strSql)

      if RsRecords.RecordCount>0 then 

      


    I would like to sort DESC on the EventToDate field.  I tried adding an ORDERBY clause but it did not work?

    Any help would be appreciated. Thank you

  • if intMemberId"" then

    strSql="select tblEvent.EventID as EventID,tblEvent.Event as Event,tblEventCategory.EventCategory as EventCategory,tblEvent.EventDate as EventDate,tblEvent.EventToDate from tblEvent,tblEventCategory where MemberId=" & intMemberId & _

    "and tblEvent.EventCategoryCode=tblEventCategory.EventCategoryCode ORDER BY tblEvent.EventToDate DESC"

    set RsRecords=GetRecords(strSql)

  • Thank you very much worked fine! I had the ORDER BY in the wrong place, and did not have the table name in the statement.

     

    Thank you again, a great lesson to learn.

    Victoria

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply