Using a variable as a view name in a select

From: "Wilkinson, Jim" <Jim(dot)Wilkinson(at)cra-arc(dot)gc(dot)ca>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Using a variable as a view name in a select
Date: 2007-04-03 13:04:00
Message-ID: 7CCC5BEF5E72394C963E529B54EB4A642A19B3@SD01ITMV12.PROD.NET
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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);

==================

Start_month = april

End_month = May

What I what to pass to the select is the combination of the 2 fields as
the view name.

Any ideas ?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2007-04-03 13:16:38 Re: Using a variable as a view name in a select
Previous Message Carlos Santos 2007-04-03 12:48:41 LOCK command inside a TRANSACTION