X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8537CD1B974 for ; Thu, 25 Mar 2004 13:25:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 96592-04 for ; Thu, 25 Mar 2004 09:25:31 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id B096ED1B896 for ; Thu, 25 Mar 2004 09:25:28 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i2PDPS1Y059843 for ; Thu, 25 Mar 2004 13:25:28 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i2PDN1Eg059304 for pgsql-sql@postgresql.org; Thu, 25 Mar 2004 13:23:01 GMT From: Gregor Rot User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.sql Subject: order of results Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 19 Message-ID: Date: Thu, 25 Mar 2004 14:23:00 +0100 X-Complaints-To: abuse@siol.net Organization: Slovenija OnLine - SiOL To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/253 X-Sequence-Number: 17352 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