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 |
|
JezLisle
Posting Yak Master
132 Posts |
Posted - 2008-09-24 : 09:53:33
|
| I have this query in SQL Server that brings me back the Max number of weeks within a recordset. I have some that have no records in, how can I say in the code below that if its Null then show Zero?[CODE]SELECT Convert(varchar, Max([Weeks Waiting])) + ' Weeks' As [Max]FROM jez.WL_DATA[/CODE] |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-09-24 : 10:01:31
|
| SELECT ISNULL(Convert(varchar, Max([Weeks Waiting])),'0' + ' Weeks' As [Max]FROM jez.WL_DATAjim |
 |
|
|
bjoerns
Posting Yak Master
154 Posts |
Posted - 2008-09-24 : 10:10:48
|
| SELECT ISNULL(Convert(varchar, Max([Weeks Waiting])),'0') + ' Weeks' As [Max]FROM jez.WL_DATA |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-24 : 16:56:25
|
SELECT CAST(MAX([Weeks waiting]) AS VARCHAR(11)) + ' weeks'from (select max([Weeks waiting]) AS [Weeks waiting]from jez.wl_dataunion allselect 0) AS d E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|