Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id DF2E59FA5AC for ; Thu, 13 Sep 2007 12:44:43 -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 50241-01 for ; Thu, 13 Sep 2007 12:44:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from polaris.pinpointresearch.com (66-7-238-130.static-ip.telepacific.net [66.7.238.130]) by postgresql.org (Postfix) with ESMTP id 3BEE59F99BC for ; Thu, 13 Sep 2007 12:44:37 -0300 (ADT) Received: from [192.168.1.179] (betelgeuse.pinpointresearch.com [192.168.1.179]) by polaris.pinpointresearch.com (Postfix) with ESMTP id 3E49DE00EC83; Thu, 13 Sep 2007 08:44:35 -0700 (PDT) Message-ID: <46E95AE2.6020304@pinpointresearch.com> Date: Thu, 13 Sep 2007 08:44:34 -0700 From: Steve Crawford User-Agent: Thunderbird 1.5.0.10 (X11/20060911) MIME-Version: 1.0 To: volunteer@spatiallink.org CC: pgsql-general@postgresql.org, alex@purefiction.net, rdeleonp@gmail.com Subject: Re: query help References: <20070913083216.b22b5ede89d48a4249261b5ab56693f4.042780b475.wbe@email.secureserver.net> In-Reply-To: <20070913083216.b22b5ede89d48a4249261b5ab56693f4.042780b475.wbe@email.secureserver.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.233 tagged_above=0 required=5 tests=AWL=-0.626, BAYES_20=-0.74, RDNS_DYNAMIC=0.1, WHOIS_MYPRIVREG=1.499 X-Spam-Level: X-Archive-Number: 200709/655 X-Sequence-Number: 120578 volunteer@spatiallink.org wrote: > hello > i add more column not row for new user. i want all "last like 'J%'". > http://www.nabble.com/an-other-provokative-question---tf4394285.html > sincerely > siva You add a new _column_ for each user?!? That is hideously broken in so many ways. It makes the trivially easy query you are trying to write rather complicated, prevents you from being able to use indexes for either constraints or performance and requires you to change your table definition anytime you add data. And that's just for starters. Fix your table so it has three columns (id, first, last). Then your query is as easy as: select id,first,last from foo where last like 'J%'; Cheers, Steve