Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)

  • RE: case statement

    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...

  • RE: case statement

    Thanks a lot, your case statement also worked 🙂

  • RE: case statement

    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...

  • RE: case statement

    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...

  • RE: case statement

    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'...

  • RE: case statement

    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'...

  • RE: Trying to get max value with column name for each row using pivot?

    Thanks a lot for replying and explaining step by step 🙂 Really appreciate:-)

  • RE: Trying to get max value with column name for each row using pivot?

    Martin Schoombee (9/1/2011)


    Almost there 🙂

    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,...

  • RE: Trying to get max value with column name for each row using pivot?

    Martin Schoombee (9/1/2011)


    sql4us (9/1/2011)


    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...

  • RE: Trying to get max value with column name for each row using pivot?

    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...

Viewing 10 posts - 1 through 10 (of 10 total)