From: Wilkinson, Jim <Jim.Wilkinson@cra-arc.gc.ca>
To: pgsql-sql@postgresql.org
Subject: Selecting different views from a Boolean expression
Date: Mon, 26 Mar 2007 09:36:10 -0400
Message-ID: <7CCC5BEF5E72394C963E529B54EB4A642A198C@SD01ITMV12.PROD.NET> (raw)
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
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: Jim.Wilkinson@cra-arc.gc.ca
Subject: Re: Selecting different views from a Boolean expression
In-Reply-To: <7CCC5BEF5E72394C963E529B54EB4A642A198C@SD01ITMV12.PROD.NET>
* 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