Re: [SQL] Using a variable as a view name in a select

2007-04-03 Thread Wilkinson, Jim
PROTECTED] Sent: April 3, 2007 12:45 PM To: Wilkinson, Jim Cc: pgsql-sql@postgresql.org Subject: RE: [SQL] Using a variable as a view name in a select Jim So let's suppose you have a "master" table of incidents incident_no (serial) incident_date (timestamp) other fields My unders

Re: [SQL] Using a variable as a view name in a select

2007-04-03 Thread Hilary Forbes
ne July  Aug  …. === Falls 1  0  1  0  0 . . . .   Can you think of another way to do this ?     From: Hilary Forbes [ mailto:[EMAIL PROTECTED]] Sent: April 3, 2007 10:14 AM To: Wilkinson, Jim; pg

Re: [SQL] Using a variable as a view name in a select

2007-04-03 Thread Hilary Forbes
Jim My initial reaction is what are you trying to achieve?  Surely you could have one underlying table with dates in it and SELECT * from mytable WHERE date1>='2007/04/01' AND date2<='2007/05/01'; but otherwise, like John, I would use an external scripting language to create the table name. Hilar

Re: [SQL] Using a variable as a view name in a select

2007-04-03 Thread John Summerfield
Wilkinson, Jim wrote: I have created a view, called april_may. I need to select this view by combineing to fields in the database to create the view name etc ... Jim Learn to use "compose" or "write" and not "reply" when you want to ask a fresh question. My email rolled this into the "LOCK"

Re: [SQL] Using a variable as a view name in a select

2007-04-03 Thread A. Kretschmer
am Tue, dem 03.04.2007, um 9:04:00 -0400 mailte Wilkinson, Jim folgendes: > I have created a view, called april_may. I need to select this view by > combineing to fields in the database to create the view name etc ? Please, no answer to an other mail and change the subject to a new subject. Yo

[SQL] Using a variable as a view name in a select

2007-04-03 Thread Wilkinson, Jim
I have created a view, called april_may. I need to select this view by combineing to fields in the database to create the view name etc ... Create view as select * from table_X; I need to do something like this ... Select * from (select table.start_month||_||table.end_month); ==