On Fri, Jan 20, 2006 at 12:24:37AM -0800, First Last wrote:
> how can i make use of the column number instead of the column
> name when making the select statement?
> for instance:
> "SELECT mytable.col, mytable.col, mytable.col, mytable.userid from mytable"
I don't think you can do that in ordinary SQL, but you could query
the system catalogs to get the table structure and generate a list
of column names from that.
> i have several tables and i need to extract the first three columns
> and a known column. the first three columns for the different tables
> vary, but all the tables have the userid column.
Can you tell us a little more about what you're doing? Some people
would question this design, arguing that a relation's attributes
should be referenced by name and that the order in which they happen
to be stored should be irrelevant and not relied upon. However,
without knowing what you're doing it's hard to insist that such a
generalization should apply to your case.
In response to
pgsql-novice by date
|Next:||From: David Chapman||Date: 2006-01-22 02:39:28|
|Subject: msysconf error|
|Previous:||From: First Last||Date: 2006-01-20 08:24:37|
|Subject: column number instead of column name|