mysql in operator

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
slash_gnr3k
Forum Commoner
Posts: 43
Joined: Tue Nov 28, 2006 6:41 pm

mysql in operator

Post by slash_gnr3k »

hi,
im having a small problem with this:

SELECT ingid FROM ingredients WHERE name IN ("spaghetti","chips","mince");

the ids for these dishes are

spaghetti -7
chips -10
mince 8

the stament above returns them in ascending order. how can i get this statement to return them in order of input - 7,10,8??

this is a statement from some php i am doing, it all works but i NEED them to be in the order of input

does anyone know?
thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply