Results 1 to 4 of 4

Thread: Sorting Records

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    OK here is the setup of my database

    Table #1 Name = Lists

    Fields:

    ListName
    ItemName
    AmtNum
    AmtType

    Table #2 Name = Items

    Fields:

    ItemName
    Category

    Now what I want to do is Open a recordset with an SQL statement similar to this and have it sorted by Category

    sSQL = "SELECT * FROM Lists WHERE ListName = '" & pListName & "' ORDER BY Items.Category ASC;"

    However (obviously) this doesn't work, how can I get this recordset sorted by category using an SQL statement, any ideas?
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    If you are sorting by you must include the field you are sorting on. As you have it you have not included the field catogory into your selection as you are only selecting from table1.
    NOt sure on this but something to this effect

    sSQL = "SELECT * FROM Lists,Category from items WHERE ListName = '" & pListName & "' ORDER BY Items.Category ASC;"

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    sSQL = "SELECT * FROM Lists , Items WHERE ListName = '" & pListName & "' And Lists.ItemName = Items.ItemName ORDER BY Items.Category ASC;"

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987

    Thumbs up

    Thanks jahangir and HeSaidJoe works great now!
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

Posting Permissions

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



Click Here to Expand Forum to Full Width