Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > ORDER BY FIELD ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 15506 of 16015
Post > Topic >>

ORDER BY FIELD feature

by kreynolds98092@[EMAIL PROTECTED] (Kevin Reynolds) May 10, 2008 at 11:09 AM

--0-1713295814-1210442987=:18955
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Does postgresql have something similar to the ORDER BY FIELD feature found
in MySQL?
   
  Something like ORDER BY FIELD(ID, 10, 2, 56, 40);
   
  It is listed here: 
http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html
   
  I am using the Sphinx Search program, www.sphinxsearch.com, and it
returns a list of IDs ordered by relevance.  I take the array it gives me
and create a comma separated list which is used in a postgres query using
the WHERE "ID" IN (10, 2, 56, 40) statement.  I would like to order the
result by the order of the list.
   
  Thanks.

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it
now.
--0-1713295814-1210442987=:18955
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<div>Does postgresql have something similar to the ORDER BY FIELD feature
found in MySQL?</div>  <div>&nbsp;</div>  <div>Something like ORDER BY
FIELD(ID, 10, 2, 56, 40);</div>  <div>&nbsp;</div>  <div>It is listed
here:&nbsp; <A
href="http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html">http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html</A></div>
 <div>&nbsp;</div>  <div>I am using the Sphinx Search program, <A
href="http://www.sphinxsearch.com">www.sphinxsearch.com</A>,
and it
returns a list of IDs ordered by relevance.&nbsp; I take the array it
gives me and create a comma separated list which is used in a postgres
query using the WHERE "ID" IN (10, 2, 56, 40) statement.&nbsp; I would
like to order the result by the order of the list.</div> 
<div>&nbsp;</div>  <div>Thanks.</div><p>&#32;



      <hr size=1>Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile. <a
href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
"> Try it now.</a>
--0-1713295814-1210442987=:18955--
 




 2 Posts in Topic:
ORDER BY FIELD feature
kreynolds98092@[EMAIL PRO  2008-05-10 11:09:47 
Re: ORDER BY FIELD feature
guillaume@[EMAIL PROTECTE  2008-05-12 11:27:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Wed Jul 9 0:12:09 CDT 2008.