SQL query

by "Sue Bailey" <sue(at)bartandsue.co.uk>

 Date:  Wed, 4 Oct 2000 15:40:31 +0100
 To:  <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
Hi all!

If I have a SQL query such as SELECT * FROM table WHERE item = '3' OR item =
'2' OR item = '1' , and don't have any ORDER BY clause, the result I get
from MySQL seems to automatically order itself by item (i.e. it would give
me the results to the above ordered 1 - 2 - 3).

Firstly, is this correct - I'm sure yesterday it was ordering according to
the values for item I was giving it! -- which is what I want it to do.

Secondly, is there any way get it to respect the order I've given it, seeing
as the array of items is totally arbitrary and bears no relation (nor could
be made to bear any relation) to any sorting of the db.

(The item values are cookies from a shopping cart, so the only way I can see
to keep it matching the other relevent cookies -- quantities etc -- would be
to make multiple queries, one for each item. Seems a bit heavy handed to
me!)

Any thoughts would be very welcome to my weary brain!! And I apologise if I
haven't made sense ;-)

Sue

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA