|
-
Jan 4th, 2001, 02:43 PM
#1
Thread Starter
Fanatic Member
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}
-
Jan 4th, 2001, 02:53 PM
#2
_______
<?>
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
-
Jan 4th, 2001, 03:14 PM
#3
sSQL = "SELECT * FROM Lists , Items WHERE ListName = '" & pListName & "' And Lists.ItemName = Items.ItemName ORDER BY Items.Category ASC;"
-
Jan 4th, 2001, 03:26 PM
#4
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|