Hi !


First, could do avoir hijacking somebody else thread ?

Andrew Braithwaite wrote:
Hello,

Is there any way to get MySQL to return the results of this query with
the 'fieldname' in the order listed in the in() bit?

select fieldname from tablename where fieldname in
('B4079','B4076','B4069','B4041','A4710','58282','58220','56751','56728'
,'45003','09234','04200','04035','04026');

what about :

select fieldname from tablename where fieldname in ('B4079','B4076','B4069','B4041','A4710','58282','58220','56751','56728'
,'45003','09234','04200','04035','04026')
Order by
'B4079'!=fieldname,
'B4076'!=fieldname,
'B4069'!=fieldname,
'B4041'!=fieldname,
'A4710'!=fieldname,
'58282'!=fieldname,
'58220'!=fieldname,
'56751'!=fieldname,
'56728'!=fieldname,
'45003'!=fieldname,
'09234'!=fieldname,
'04200'!=fieldname,
'04035'!=fieldname,
'04026'!=fieldname


(from a yesterday proposal)



i.e. I want row 1 to have fieldname=' B4079', row 2 to have fieldname='B4076', etc.

Or is there any other way to list the results by the order as defined in
a list specified in the query.

Please don't reply saying that I should do this in the application layer
as that isn't an option.

Thanks for any help at all on this...

Cheers,

Andrew

MySQL, Query





--
Philippe Poelvoorde
COS Trading Ltd.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to