Re: [SQL] Select in From clause

2007-11-12 Thread Bart Degryse
Consider this: CREATE TABLE "public"."test" ( "id" INTEGER NOT NULL, "tbl" TEXT ) WITHOUT OIDS; INSERT INTO "public"."test" ("id", "tbl") VALUES (1, 'status'); INSERT INTO "public"."test" ("id", "tbl") VALUES (2, 'yearplan'); Following two statements will return one record. select tbl from

Re: [SQL] Select in From clause

2007-11-09 Thread Alvaro Herrera
Ray Madigan wrote: > I have never seen this done before, but it seems like it is supposed to work > from reading the manual. > > I want to be able to get a table name from another table and use it in the > from clause of a select. > > Something like > > SELECT * FROM (SELECT name FROM bar WHERE

[SQL] Select in From clause

2007-11-09 Thread Ray Madigan
I have never seen this done before, but it seems like it is supposed to work from reading the manual. I want to be able to get a table name from another table and use it in the from clause of a select. Something like SELECT * FROM (SELECT name FROM bar WHERE conditions) AS b WHERE b.condition =