order of results

From: Gregor Rot <zara4tustra(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: order of results
Date: 2004-03-25 13:23:00
Message-ID: S2B8c.6954$%x4.923499@news.siol.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

i have a table called "people" (name:varchar, lastname:varchar).

i do a select on it:

select * from people where name like '%n1%' or lastname like '%l1%'.

i would like the results in this order:

first the results that satisfy only the (name like '%n1%') condition,
then the ones that satisfy only the (lastname like '%l1%') condition and
last the results that satisfy both conditions.

Is this possible in only one SQL?
(note that the search conditions n1 and l1 differ from search to search.

TNX,
Gregor

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Okeh, Sam 2004-03-25 19:21:36 Using Bounding Box as a where predicate
Previous Message Bulatovic Natasa 2004-03-24 12:24:46 Invalid Unicode Character Sequence found