Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7861D9FA02D for ; Thu, 13 Sep 2007 12:50:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 52214-04 for ; Thu, 13 Sep 2007 12:50:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from tomts36-srv.bellnexxia.net (tomts36.bellnexxia.net [209.226.175.93]) by postgresql.org (Postfix) with ESMTP id 46A439F9FD8 for ; Thu, 13 Sep 2007 12:50:38 -0300 (ADT) Received: from [192.168.1.7] ([70.51.86.37]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070913155036.FJZW7990.tomts36-srv.bellnexxia.net@[192.168.1.7]> for ; Thu, 13 Sep 2007 11:50:36 -0400 Message-ID: <46E95C3C.9060307@zijn-digital.com> Date: Thu, 13 Sep 2007 11:50:20 -0400 From: brian User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-general@postgresql.org 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; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/657 X-Sequence-Number: 120580 volunteer@spatiallink.org wrote: > hello > i add more column not row for new user. i want all "last like 'J%'". I get the feeling that the result as you've laid it out is not what we all think it is. For example: >>table is >>+-------+-------+------+-------+ >>| id | one | two | three | >>+-------+-------+------+-------+ >>| first | Jack | Jill | Mary | >>| last | Ja | Ji | Ma | >>+-------+-------+------+-------+ I took that to meant that you have columns 'id', 'one', two', three', and that 'first' & 'last' are field values. However, it now seems that 'first' & 'last' are column names. If so, this makes no sense. I think what you wanted to give us was: +-------+-------+------+ | id | first | last | +-------+-------+------+ | one | Jack | Ja | | two | Jill | Ji | | three | Mary | Ma | result: +-------+-------+------+ | id | first | last | +-------+-------+------+ | one | Jack | Ja | | two | Jill | Ji | So, the query you want is, in fact: SELECT * FROM your_table WHERE last LIKE ('J%'); If that's not working for you, it's perhaps because you have rows for columns and columns for rows. > http://www.nabble.com/an-other-provokative-question---tf4394285.html > sincerely > siva > What the heck does this have to do with anything? Please don't top-post. brian