Re: Using a variable as a view name in a select - Mailing list pgsql-sql

From Hilary Forbes
Subject Re: Using a variable as a view name in a select
Date
Msg-id 200704031408.l33E81Wx015401@tamar.dmr.co.uk
Whole thread Raw
In response to LOCK command inside a TRANSACTION  (Carlos Santos <carloscompels@yahoo.com.br>)
List pgsql-sql
Jim<br /><br /> My initial reaction is what are you trying to achieve?  Surely you could have one underlying table
withdates in it and<br /><br /> SELECT * from mytable WHERE date1>='2007/04/01' AND date2<='2007/05/01';<br /><br
/>but otherwise, like John, I would use an external scripting language to create the table name.<br /><br /> Hilary<br
/><br/> At 14:04 03/04/2007, Wilkinson, Jim wrote:<br /><br /><blockquote cite="" class="cite" type="cite"><font
color="#000080"size="2">I have created a view, called april_may.   I need to select this view by combineing to fields
inthe database to create the view name etc …<br />  <br /> Create view as select * from table_X;<br />  <br /> I need
todo something like this … <br />  <br /> Select * from (select table.start_month||_||table.end_month);<br />
==================<br/> Start_month  = april<br /> End_month = May<br />  <br /> What I what to pass to the select is
thecombination of the 2 fields as the view name.<br />  <br /> Any ideas ?</font></blockquote><p> Hilary Forbes<br />
DMRLimited (UK registration 01134804) <br /> A DMR Information and Technology Group company (<a eudora="autourl"
href="http://www.dmr.co.uk/"><fontcolor="#0000FF"> <u>www.dmr.co.uk</u></font></a>) <br /> Direct tel 01689 889950 Fax
01689860330 <br /> DMR is a UK registered trade mark of DMR Limited<br />
**********************************************************

pgsql-sql by date:

Previous
From: John Summerfield
Date:
Subject: A long-running transaction
Next
From: Richard Broersma Jr
Date:
Subject: Re: Serial