Re: MySQL Sort by Array

2008-10-23 Thread Bill Newton

Pretty standard mysql function. Its been in mysql for a while.

http://dev.mysql.com/doc/refman/4.1/en/string-functions.html#function_field



Jim Lyons wrote:

I'm not familiar with order by field (unless field is a UDF).  I know of
order by binary.  Is this standard mysql syntax?

On Wed, Oct 22, 2008 at 10:42 AM, Peter Brawley [EMAIL PROTECTED]
  

wrote:



  

ORDER BY id(5, 34, 9, 25)


Can anyone tell me the proper syntax to accomplish this task?

  

ORDER BY FIELD( id, 5, 34, 9, 25 )

PB

-

Keith Spiller wrote:



Hi Guys,

I'm trying to sort by a particular order:

SELECT * FROM tablename
WHERE id='5' OR id='9' OR id='25' OR id='34'
ORDER BY id(5, 34, 9, 25)

Can anyone tell me the proper syntax to accomplish this task?

Thanks for your help.

Keith
 


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database:
270.8.2/1739 - Release Date: 10/22/2008 7:23 AM



  



  



--
Bill Newton
Network Merchants Inc.
http://www.nmi.com
(847) 352-4850 ext 141/ Tel
(888) 829-3631/ Fax


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



Re: MySQL Sort by Array

2008-10-23 Thread Moon's Father
Just staightly use ... in .. is ok.

On Fri, Oct 24, 2008 at 12:57 AM, Bill Newton
[EMAIL PROTECTED]wrote:

 Pretty standard mysql function. Its been in mysql for a while.

 http://dev.mysql.com/doc/refman/4.1/en/string-functions.html#function_field




 Jim Lyons wrote:

 I'm not familiar with order by field (unless field is a UDF).  I know of
 order by binary.  Is this standard mysql syntax?

 On Wed, Oct 22, 2008 at 10:42 AM, Peter Brawley 
 [EMAIL PROTECTED]


 wrote:





 ORDER BY id(5, 34, 9, 25)


 Can anyone tell me the proper syntax to accomplish this task?



 ORDER BY FIELD( id, 5, 34, 9, 25 )

 PB

 -

 Keith Spiller wrote:



 Hi Guys,

 I'm trying to sort by a particular order:

 SELECT * FROM tablename
 WHERE id='5' OR id='9' OR id='25' OR id='34'
 ORDER BY id(5, 34, 9, 25)

 Can anyone tell me the proper syntax to accomplish this task?

 Thanks for your help.

 Keith

  


 No virus found in this incoming message.
 Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database:
 270.8.2/1739 - Release Date: 10/22/2008 7:23 AM











 --
 Bill Newton
 Network Merchants Inc.
 http://www.nmi.com
 (847) 352-4850 ext 141/ Tel
 (888) 829-3631/ Fax



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




-- 
I'm a MySQL DBA in china.
More about me just visit here:
http://yueliangdao0608.cublog.cn


MySQL Sort by Array

2008-10-22 Thread Keith Spiller
Hi Guys,

I'm trying to sort by a particular order:

SELECT * FROM tablename
WHERE id='5' OR id='9' OR id='25' OR id='34'
ORDER BY id(5, 34, 9, 25)

Can anyone tell me the proper syntax to accomplish this task?

Thanks for your help.

Keith

Re: MySQL Sort by Array

2008-10-22 Thread Peter Brawley

ORDER BY id(5, 34, 9, 25)
Can anyone tell me the proper syntax to accomplish this task?


ORDER BY FIELD( id, 5, 34, 9, 25 )

PB

-

Keith Spiller wrote:

Hi Guys,

I'm trying to sort by a particular order:

SELECT * FROM tablename
WHERE id='5' OR id='9' OR id='25' OR id='34'
ORDER BY id(5, 34, 9, 25)

Can anyone tell me the proper syntax to accomplish this task?

Thanks for your help.

Keith
  




No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.175 / Virus Database: 270.8.2/1739 - Release Date: 10/22/2008 7:23 AM


  


Re: MySQL Sort by Array

2008-10-22 Thread Jim Lyons
I'm not familiar with order by field (unless field is a UDF).  I know of
order by binary.  Is this standard mysql syntax?

On Wed, Oct 22, 2008 at 10:42 AM, Peter Brawley [EMAIL PROTECTED]
 wrote:

 ORDER BY id(5, 34, 9, 25)
 Can anyone tell me the proper syntax to accomplish this task?


 ORDER BY FIELD( id, 5, 34, 9, 25 )

 PB

 -

 Keith Spiller wrote:

 Hi Guys,

 I'm trying to sort by a particular order:

 SELECT * FROM tablename
 WHERE id='5' OR id='9' OR id='25' OR id='34'
 ORDER BY id(5, 34, 9, 25)

 Can anyone tell me the proper syntax to accomplish this task?

 Thanks for your help.

 Keith
  


 No virus found in this incoming message.
 Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database:
 270.8.2/1739 - Release Date: 10/22/2008 7:23 AM






-- 
Jim Lyons
Web developer / Database administrator
http://www.weblyons.com


Re: MySQL Sort by Array

2008-10-22 Thread Rob Wultsch
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_field

it is
ORDER BY ...
and in this case the ... is the function described above.

On Wed, Oct 22, 2008 at 12:24 PM, Jim Lyons [EMAIL PROTECTED] wrote:

 I'm not familiar with order by field (unless field is a UDF).  I know of
 order by binary.  Is this standard mysql syntax?

 On Wed, Oct 22, 2008 at 10:42 AM, Peter Brawley 
 [EMAIL PROTECTED]
  wrote:

  ORDER BY id(5, 34, 9, 25)
  Can anyone tell me the proper syntax to accomplish this task?
 
 
  ORDER BY FIELD( id, 5, 34, 9, 25 )
 
  PB
 
  -
 
  Keith Spiller wrote:
 
  Hi Guys,
 
  I'm trying to sort by a particular order:
 
  SELECT * FROM tablename
  WHERE id='5' OR id='9' OR id='25' OR id='34'
  ORDER BY id(5, 34, 9, 25)
 
  Can anyone tell me the proper syntax to accomplish this task?
 
  Thanks for your help.
 
  Keith
 
  
 
 
  No virus found in this incoming message.
  Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database:
  270.8.2/1739 - Release Date: 10/22/2008 7:23 AM
 
 
 
 


 --
 Jim Lyons
 Web developer / Database administrator
 http://www.weblyons.com




-- 
Rob Wultsch
[EMAIL PROTECTED]
wultsch (aim)


Re: MySQL Sort by Array

2008-10-22 Thread Uwe Kiewel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Keith Spiller schrieb:
 Hi Guys,

 I'm trying to sort by a particular order:

 SELECT * FROM tablename
 WHERE id='5' OR id='9' OR id='25' OR id='34'

what about ... WHERE id in (5, 9, 25, 34) ...

 ORDER BY id(5, 34, 9, 25)

like the others said


 Can anyone tell me the proper syntax to accomplish this task?

 Thanks for your help.

 Keith

Uwe

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJI/5MmAAoJEEJXG7BUuynnkQAQAIfGGw+KpMukrwZcGEO39W+7
kBYpKqGlEWKSO1fWQNWDoXFACzhJP/gnBaBqHjVxe80rkuKFukfpA0+yZ0GBERUN
boNq+qiHG5Cr5DTHyQ/FQg5vQj5sO4V+iR5yBjUxYzpGPGPpNB2PHAeV1MorOTBX
MfJJpRmK+oT60rE4kpsTzozpk31si5kVU7QW/Z3tGLQlyYcldEBLvBMjO9iS9uFF
OmFbcRcA3goRjKiIV7B9Ps17rnFneezYD8WXlamxl5hf0/fih5xf/iIBKdpmvtZO
iaMM/HkrCVllWFOTxOfXBTLSDBlQPi8NjGiqJ5DUYD0KvrSPF8nrSZdqJUMlcl33
25tYUzM4mp/AxszGqtD5R/USVFecWKz1sF3UVjIDN/1cSvLN+Eq+S1cGGsFImsgl
CZaXW7crGPZyu2DvnrXp74btCMf0y/N6etT6xiQArl2R0YjiDncHcmASH+VmmTwR
W9XIX5mIaAEKz8bsQXZKZ9Vb2Mbf5oz4cD3DH2rNfQSDK6zL4qcpbylhLwOJMX+W
DR43GaIkJuv/myjfDK1Q+clBoaI13OB13TaagGOC6nHZTFGTg6aurVXq2uWCOG4r
G7l7HdrnQwO8VbmjiGYVI6w/mLl7/dBUwhkIJhOgbeqJMYTMMrS5x3si/Y8W2iz5
qNJ16hL29Rd8XlIRdG8W
=wRny
-END PGP SIGNATURE-

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