Viewing 10 posts - 1 through 10 (of 10 total)
Thanks your case statement also worked 🙂
ChrisM@Work (9/26/2011)
SELECT K.[test],CASE
WHEN K.[test] = 'N/A' THEN '0'
WHEN CAST(K.[test] AS DECIMAL(5,1)) BETWEEN 0 AND 19.9 THEN '1'
WHEN CAST(K.[test] AS DECIMAL(5,1)) BETWEEN 20...
September 26, 2011 at 11:03 am
Thank you so much , it worked 🙂 I had '%' in my query to represent the values as percentage, because of that it was causing an issue, when...
September 26, 2011 at 11:02 am
ChrisM@Work (9/26/2011)
SELECT K.[test],CASE
WHEN K.[test] = 'N/A' THEN '0'
WHEN CAST(K.[test] AS DECIMAL(5,1)) BETWEEN 0 AND 19.9 THEN '1'
WHEN CAST(K.[test] AS DECIMAL(5,1)) BETWEEN 20 AND 34.9 THEN '2'
WHEN CAST(K.[test] AS...
September 26, 2011 at 10:51 am
Lowell (9/26/2011)
sql4us (9/26/2011)
Thanks for the reply. I tried cast and also convert as you mentioned (below code), it throws me an error"Error converting data type varchar to numeric."
besides 'N/A'...
September 26, 2011 at 10:48 am
Thanks for the reply. I tried cast and also convert as you mentioned (below code), it throws me an error
"Error converting data type varchar to numeric."
CASE
WHEN K.[test] = 'N/A'...
September 26, 2011 at 10:24 am
Thanks a lot for replying and explaining step by step 🙂 Really appreciate:-)
September 2, 2011 at 6:03 am
Martin Schoombee (9/1/2011)
Two things to consider:
1. Your order by clause should only include the maxvalue column and not the zip code.
2. Encapsulate your whole query in a cte,...
September 1, 2011 at 2:08 pm
Martin Schoombee (9/1/2011)
sql4us (9/1/2011)
September 1, 2011 at 1:47 pm
I have 30,000 records..I almost got it but if you saw my code and results it shows all the values for the same zipcode. I just need max value, column...
September 1, 2011 at 1:19 pm
Viewing 10 posts - 1 through 10 (of 10 total)