Re: query help - Mailing list pgsql-general

From Steve Crawford
Subject Re: query help
Date
Msg-id 46E95AE2.6020304@pinpointresearch.com
Whole thread Raw
In response to Re: query help  (volunteer@spatiallink.org)
List pgsql-general
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


pgsql-general by date:

Previous
From: "Alexander Staubo"
Date:
Subject: Re: query help
Next
From: volunteer@spatiallink.org
Date:
Subject: Re: query help