From: | "Wilkinson, Jim" <Jim(dot)Wilkinson(at)cra-arc(dot)gc(dot)ca> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Selecting different views from a Boolean expression |
Date: | 2007-03-26 13:36:10 |
Message-ID: | 7CCC5BEF5E72394C963E529B54EB4A642A198C@SD01ITMV12.PROD.NET |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi there,
I have a web based reporting system that I am coding. I need to be able
to view statistics by the calendar year or the fiscal year depending on
what the user selects.
My issue is how do I change y select statements to change the column
output?
Example
Incident Jan Feb Mar Apr May June
July Aug Sep Oct Nov Dec
======= === === === ==== === ==== === ====
==== ==== ==== ====
Falls 1 1 0 0 0 0 0
0 0 0 0 0
Overdose 0 1 0 1 1 1 0
0 0 1 1 0
But if the user selects fiscal year the output could be:
Incident Jun Jul Aug sept Oct Nov
Dec Jan Feb Mar Apr May
======= === === === ==== === ==== === ====
==== ==== ==== ====
Falls 1 1 0 0 0 0 0
0 0 0 0 0
Overdose 0 1 0 1 1 1 0
0 0 1 1 0
I have created select views for each month possibility, but I don't know
how to select the view I need from an IF/Then/else statement!!
Any help would be appreciated.
Thanks
From | Date | Subject | |
---|---|---|---|
Next Message | ezequias | 2007-03-26 21:01:19 | Shared Buffers |
Previous Message | Michael Fuhr | 2007-03-23 11:47:03 | Re: How to declare cursor if tablename is a variable? |