pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Crawford <scrawford@pinpointresearch.com>
To: volunteer@spatiallink.org
Cc: pgsql-general@postgresql.org
Cc: alex@purefiction.net
Cc: rdeleonp@gmail.com
Subject: Re: query help
Date: Thu, 13 Sep 2007 08:44:34 -0700
Message-ID: <46E95AE2.6020304@pinpointresearch.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%'".
> 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




view thread (70+ messages)  latest in thread

Message-ID: <46E95AE2.6020304@pinpointresearch.com>
Permalink:  ../46E95AE2.6020304@pinpointresearch.com/
Also on:    postgresql.org/message-id/46E95AE2.6020304@pinpointresearch.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: scrawford@pinpointresearch.com, volunteer@spatiallink.org, alex@purefiction.net, rdeleonp@gmail.com
  Subject: Re: query help
  In-Reply-To: <46E95AE2.6020304@pinpointresearch.com>
  References: <20070913083216.b22b5ede89d48a4249261b5ab56693f4.042780b475.wbe@email.secureserver.net> <46E95AE2.6020304@pinpointresearch.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