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" thread making it incredibly difficult to find.


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 ?

The simple ways I can think of are external to postgresql, and depend on your host environment.

For example, on Linux (or OS X) I might do something like this:

psql -c "select * from (select table.$(date +%B -d 'last month')_table.$(date +%B))"

Note, the above para is really a single line, there is a space between "last" and "month."

on DOS it might be a little trickier, but probably VB Script can do it.

In Java, it is somewhat similar but different.

If this doesn't answer, give better info and maybe someone else can help you properly.


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to