From: Hilary Forbes <hforbes@dmr.co.uk>
To: Wilkinson, Jim <Jim.Wilkinson@cra-arc.gc.ca>
To: pgsql-sql@postgresql.org
Subject: Re: Using a variable as a view name in a select
Date: Tue, 03 Apr 2007 15:14:22 +0100
Message-ID: <200704031408.l33E81Wx015401@tamar.dmr.co.uk> (raw)
In-Reply-To: <7CCC5BEF5E72394C963E529B54EB4A642A19B3@SD01ITMV12.PROD.NET >
References: <141386.39515.qm@web57105.mail.re3.yahoo.com>
<7CCC5BEF5E72394C963E529B54EB4A642A19B3@SD01ITMV12.PROD.NET>
<html>
<body>
Jim<br><br>
My initial reaction is what are you trying to achieve? Surely you
could have one underlying table with dates 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 type=cite class=cite cite=""><font size=2 color="#000080">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
…<br>
<br>
Create view as select * from table_X;<br>
<br>
I need to do 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 the combination of the 2 fields as
the view name.<br>
<br>
Any ideas ?</font></blockquote>
<x-sigsep><p></x-sigsep>
Hilary Forbes<br>
DMR Limited (UK registration 01134804) <br>
A DMR Information and Technology Group company
(<a href="http://www.dmr.co.uk/"; eudora="autourl"><font color="#0000FF">
<u>www.dmr.co.uk</a></u></font>) <br>
Direct tel 01689 889950 Fax 01689 860330 <br>
DMR is a UK registered trade mark of DMR Limited<br>
**********************************************************</body>
</html>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: hforbes@dmr.co.uk, Jim.Wilkinson@cra-arc.gc.ca
Subject: Re: Using a variable as a view name in a select
In-Reply-To: <200704031408.l33E81Wx015401@tamar.dmr.co.uk>
References: <141386.39515.qm@web57105.mail.re3.yahoo.com> <7CCC5BEF5E72394C963E529B54EB4A642A19B3@SD01ITMV12.PROD.NET> <200704031408.l33E81Wx015401@tamar.dmr.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox