Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 1FD4C9FB429 for ; Mon, 6 Aug 2007 12:15:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 59685-01 for ; Mon, 6 Aug 2007 12:15:15 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 784B99FB3E9 for ; Mon, 6 Aug 2007 12:15:15 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4B9423141D; Mon, 6 Aug 2007 17:15:13 +0200 (MET DST) From: =?iso-8859-1?q?Rodrigo_De_Le=F3n?= X-Newsgroups: pgsql.sql Subject: Re: Best Fit SQL query statement Date: Mon, 06 Aug 2007 15:15:12 -0000 Organization: http://groups.google.com Lines: 9 Message-ID: <1186413312.263516.180000@l70g2000hse.googlegroups.com> References: <1186390627.045596.148460@j4g2000prf.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Complaints-To: groups-abuse@google.com In-Reply-To: <1186390627.045596.148460@j4g2000prf.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: l70g2000hse.googlegroups.com; posting-host=200.75.231.230; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/34 X-Sequence-Number: 28972 On Aug 6, 3:57 am, Kiran wrote: > and if I query on 98456 the result must be 98456, > However if I query on 98455 the result must be 9845 > and If I query 9849 the result must be 984 SELECT MAX(t1) FROM t1 WHERE '9849' LIKE t1 || '%';