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 |
|
Humate
Posting Yak Master
101 Posts |
Posted - 2007-12-14 : 09:42:54
|
| Hi All,I have an SQL query that returns results as I want to see them, code below.select[id],max(case when [Name] = 'HKT' then [date] else '' end) as [Results]from Outcomesgroup by [id]The reults column returns the date for each id, but when this is zero in the data, it is entered as 1900-01-01 00:00:00.000. Can I change my query so that when the date is returned in this format, to just show the cell blank in the results?Thanks in advanceHumate |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-14 : 09:57:44
|
| Tryselect[id],max(NULLIF(case when [Name] = 'HKT' then [date] else '' end,'')) as [Results]from Outcomesgroup by [id]MadhivananFailing to plan is Planning to fail |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-14 : 09:59:28
|
No "Do it in the Front-End", Madhi? Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-12-14 : 10:02:40
|
| select[id],max(case when [Name] = 'HKT' then [date] else Null end) as [Results]from Outcomesgroup by [id]- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-14 : 10:02:45
|
quote: Originally posted by harsh_athalye No "Do it in the Front-End", Madhi? Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
Now-a-days no one is listening to me MadhivananFailing to plan is Planning to fail |
 |
|
|
Humate
Posting Yak Master
101 Posts |
Posted - 2007-12-14 : 10:30:20
|
Thanks both, that does the trick! I realise I should be doing it in the front end, but this makes things easier to understand in my small brain |
 |
|
|
|
|
|
|
|