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 > Re: ORDER BY FI...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 15506 of 17437
Post > Topic >>

Re: ORDER BY FIELD feature

by guillaume@[EMAIL PROTECTED] (Guillaume Lelarge) May 12, 2008 at 11:27 AM

Kevin Reynolds a écrit :
> 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 
> <http://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.
>  

ORDER BY ID=10 DESC, ID=2 DESC, ID=56 DESC, ID=40  DESC
is the only way, AFAIK.

Regards.


-- 
Guillaume.
  http://www.postgresqlfr.org
  http://dalibo.com

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 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
tan12V112 Sat Nov 22 12:59:32 CST 2008.