Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
THM
Starting Member
4 Posts |
Posted - 2011-11-14 : 01:23:32
|
| what i want to do is take an average of some data and then preform desplay an vaule using an if statment if some conditions are true. I can get the average to work but the IF are giving me problems. Any ideas what i'm doing wrong?SELECT SAMPLE.HOLEID, AVG(CASE WHEN SAMPLEDETAILS.NAME = 'FRAG_DOL'AND SAMPLE.SAMPFROM BETWEEN '{ctrl::DV_FROM}' AND '{ctrl::DV_TO}' THEN cast(VALUE as FLOAT) ELSE NULL END) AS FRAG_DOL_AVGFROM SAMPLE AS SAMPLELEFT JOIN SAMPLEDETAILSON SAMPLE.SAMPLEID=SAMPLEDETAILS.SAMPLEIDWHERE SAMPLE.PROJECTCODE = 'UG'GROUP BY SAMPLE.HOLEIDORDER BY SAMPLE.HOLEIDIF ( ( 'FRAG_DOL_AVG') = 0) BEGIN SELECT 'FRAG_DOL_AVG' as 'test' ENDELSE BEGIN SELECT 'FRAG_DOL_AVG' as 'FAIL' END |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-14 : 01:31:03
|
| This is a presentation issue as its about giving display name. you dont need to do it sql. you need to add this logic to your presenatation layer using front end language to give it suitable header name.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|