X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 456469DC881 for ; Tue, 7 Feb 2006 05:45:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97807-10 for ; Tue, 7 Feb 2006 05:45:52 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 20EF59DC83C for ; Tue, 7 Feb 2006 05:45:49 -0400 (AST) Received: from talk.nabble.com (www.nabble.com [72.21.53.35]) by svr4.postgresql.org (Postfix) with ESMTP id B76AF5AF03D for ; Tue, 7 Feb 2006 09:45:51 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=talk.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1F6PPy-0005UO-1A for pgsql-sql@postgresql.org; Tue, 07 Feb 2006 01:45:50 -0800 Message-ID: <2798161.post@talk.nabble.com> Date: Tue, 7 Feb 2006 01:45:50 -0800 (PST) From: "superboy143 (sent by Nabble.com)" Reply-To: superboy143 To: pgsql-sql@postgresql.org Subject: query MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10597_18974862.1139305550030" X-Nabble-Sender: Nabble Forums X-Nabble-From: superboy143 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.247 required=5 tests=[AWL=0.246, HTML_MESSAGE=0.001] X-Spam-Score: 0.247 X-Spam-Level: X-Archive-Number: 200602/54 X-Sequence-Number: 24064 ------=_Part_10597_18974862.1139305550030 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, I have a table in which I have a field with format like 100101. It has many values like 100101, 100102, 100103, 100201, 100202, 100301. I have to write a query such that I have to get only distinct values such that they contain only the substring I need. If I give 10 as substring, then it should return only 100101 or 100102 but not both i.e if the last two characters are not same it should not return both of them. It should return only values starting with 10 the middle two values should be distinct and the last two characters may be anything. -- View this message in context: http://www.nabble.com/query-t1074932.html#a2798161 Sent from the PostgreSQL - sql forum at Nabble.com. ------=_Part_10597_18974862.1139305550030 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hello,

I have a table in which I have a field with format like 100101. It has many values like 100101, 100102, 100103, 100201, 100202, 100301. I have to write a query such that I have to get only distinct values such that they contain only the substring I need. If I give 10 as substring, then it should return only 100101 or 100102 but not both i.e if the last two characters are not same it should not return both of them. It should return only values starting with 10 the middle two values should be distinct and the last two characters may be anything.

View this message in context: query
Sent from the PostgreSQL - sql forum at Nabble.com. ------=_Part_10597_18974862.1139305550030--