Selecting different views from a Boolean expression - Mailing list pgsql-sql
From | Wilkinson, Jim |
---|---|
Subject | Selecting different views from a Boolean expression |
Date | |
Msg-id | 7CCC5BEF5E72394C963E529B54EB4A642A198C@SD01ITMV12.PROD.NET Whole thread Raw |
List | pgsql-sql |
<p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">Hi there,</font></span><span lang="en-ca"></span><span lang="en-ca"></span><p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">I have a web based reporting system thatI am coding. I need to be able to view statistics by the calendar year or the fiscal year</font></span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">depending</font></span><span lang="en-ca"></span><spanlang="en-ca"><font face="Arial" size="2"> on what the user selects.</font></span><p align="LEFT"><spanlang="en-ca"><font face="Arial" size="2">My issue is how do I change y select statements to</font></span><spanlang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">change</font></span><span lang="en-ca"></span><spanlang="en-ca"><font face="Arial" size="2"> the column</font></span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">output?</font></span><span lang="en-ca"></span><span lang="en-ca"></span><palign="LEFT"><span lang="en-ca"><font face="Arial" size="2">Example</font></span><p align="LEFT"><spanlang="en-ca"><font face="Arial" size="2">Incident Jan Feb Mar Apr May June July Aug </font></span><span lang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">Sep Oct Nov Dec</font></span><p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">======= === === === ==== === ==== === ==== ==== ==== ==== ====</font></span><span lang="en-ca"></span><spanlang="en-ca"></span><p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">Falls 1 1 0 0 0 0 0 0 0 0 0 0</font></span><p align="LEFT"><spanlang="en-ca"><font face="Arial" size="2">Overdose 0 1 0 1 1 1 0 0 0 1 1 0</font></span><span lang="en-ca"></span><span lang="en-ca"></span><br /><br/><p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">But if</font></span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">the user selects fiscal year</font></span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">the output could</font></span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">be:</font></span><span lang="en-ca"></span><span lang="en-ca"></span><br/><p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">Incident J</font></span><spanlang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2">un</font></span><span lang="en-ca"></span><spanlang="en-ca"><font face="Arial" size="2"> </font></span><span lang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2">Jul</font></span><span lang="en-ca"></span><span lang="en-ca"> </span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">Aug</font></span><span lang="en-ca"></span><span lang="en-ca"> </span><spanlang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">sept</font></span><spanlang="en-ca"></span><span lang="en-ca"> </span><span lang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2">Oct</font></span><span lang="en-ca"></span><span lang="en-ca"> </span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">Nov</font></span><span lang="en-ca"></span><span lang="en-ca"> </span><spanlang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">Dec</font></span><span lang="en-ca"></span><spanlang="en-ca"> </span><span lang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">Jan</font></span><spanlang="en-ca"></span><span lang="en-ca"> </span><span lang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2">Feb</font></span><span lang="en-ca"></span><span lang="en-ca"> </span><span lang="en-ca"></span><spanlang="en-ca"> <font face="Arial" size="2">Mar</font></span><span lang="en-ca"></span><span lang="en-ca"> </span><spanlang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">Apr</font></span><span lang="en-ca"></span><spanlang="en-ca"> </span><span lang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">May</font></span><spanlang="en-ca"></span><span lang="en-ca"></span><p align="LEFT"><span lang="en-ca"><font face="Arial"size="2">======= === === === ==== === ==== === ==== ==== ==== ==== ====</font></span><spanlang="en-ca"></span><span lang="en-ca"></span><p align="LEFT"><span lang="en-ca"><font face="Arial"size="2">Falls 1 1 0 0 0 0 0 0 0 0 0 0</font></span><p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">Overdose 0 1 0 1 1 1 0 0 0 1 1 0</font></span><span lang="en-ca"></span><span lang="en-ca"></span><br/><p align="LEFT"><span lang="en-ca"><font face="Arial" size="2">I have created select views for eachmonth</font></span><span lang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">possibility,</font></span><spanlang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2"> but I don</font></span><spanlang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2">’</font></span><span lang="en-ca"></span><spanlang="en-ca"><font face="Arial" size="2">t</font></span><span lang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2">know</font></span><span lang="en-ca"></span><span lang="en-ca"><font face="Arial"size="2"> how to</font></span><span lang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">select</font></span><spanlang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2"> the view I need froman IF/Then/else</font></span><span lang="en-ca"></span><span lang="en-ca"> <font face="Arial" size="2">statement!!</font></span><spanlang="en-ca"></span><span lang="en-ca"></span><p align="LEFT"><span lang="en-ca"><fontface="Arial" size="2">Any help would be</font></span><span lang="en-ca"></span><span lang="en-ca"> <fontface="Arial" size="2">appreciated</font></span><span lang="en-ca"></span><span lang="en-ca"><font face="Arial" size="2">.</font></span><palign="LEFT"><span lang="en-ca"><font face="Arial" size="2">Thanks</font></span><span lang="en-ca"></span><spanlang="en-ca"></span><p align="LEFT"><span lang="en-ca"> </span><span lang="en-ca"></span><spanlang="en-ca"> </span>