pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: brian <brian@zijn-digital.com>
To: pgsql-general@postgresql.org
Subject: Re: query help
Date: Thu, 13 Sep 2007 11:50:20 -0400
Message-ID: <46E95C3C.9060307@zijn-digital.com> (raw)
In-Reply-To: <20070913083216.b22b5ede89d48a4249261b5ab56693f4.042780b475.wbe@email.secureserver.net>
References: <20070913083216.b22b5ede89d48a4249261b5ab56693f4.042780b475.wbe@email.secureserver.net>

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



view thread (70+ messages)  latest in thread

Message-ID: <46E95C3C.9060307@zijn-digital.com>
Permalink:  ../46E95C3C.9060307@zijn-digital.com/
Also on:    postgresql.org/message-id/46E95C3C.9060307@zijn-digital.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: brian@zijn-digital.com
  Subject: Re: query help
  In-Reply-To: <46E95C3C.9060307@zijn-digital.com>
  References: <20070913083216.b22b5ede89d48a4249261b5ab56693f4.042780b475.wbe@email.secureserver.net> <46E95C3C.9060307@zijn-digital.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox