: SQL sort question


minnes
May 12th, 2003, 05:19 PM
Im thinking of a sql query statement where the result set is sorted by 2 columns at the same time is this possible?
For example if I have a list of items with titles and numbers, but it is the combination that is a unique key
would this work for example
SELECT * FROM TABLE ORDER BY TITLE, NUMBER
this is how I want the data
for example
APPLE 1
APPLE 2
BANNA 1
BANANA 2
any of you geniuses have any suggestions, if this would work in Mysql
or should I have separate tables for the Title list and item entries. My other idea is to select all the titles from a title table , then as I go down the title table , select all the entries in the item table and list them by number, this would work but needs an extra table and a couple extra lines of code, and we wouldnt want that.

hayesk
May 12th, 2003, 08:36 PM
What did you get when you tried it? That looks fine to me. You don't need separate tables for that.

minnes
May 13th, 2003, 01:20 PM
Hi hayesk
Thanks for the reply
Im juist in the middle of setting up a personal web site with some mysql tables
So, it will be a while, before I get it all functional.
Do you do much database, sql, Oracle or mysql programming?
Im finding it kind of fun to be able to get data displayed in web pages from MySql tables.