Yes, You can use the FIELD() function: SELECT * FROM table WHERE recordID IN ($string) ORDER BY FIELD(recordID,$string)
On Tue, 2003-02-04 at 13:15, Wilbert Enserink wrote: > Hi All, > > I have a string containing recordID's in a specific order (e.g. > $string=17,2,33,5,99) > How can I select those records from a table in the right order (as > determined in $string)? > > SELECT * FROM table WHERE recordID IN ($string) > > results in the right records but not in the order I want, instead the order > is determined by recordID... meaning (2,5,17,33,99) > > > Any clues??:-) > > thx in advance! > Many regards, > > Wilbert Enserink > > > sql,query,queries,smallint > > ------------------------- > Pas de Deux > Van Mierisstraat 25 > 2526 NM Den Haag > tel 070 4450855 > fax 070 4450852 > http://www.pdd.nl > [EMAIL PROTECTED] > ------------------------- > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > -- Diana Soares --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php