Displaying top Products by Price

  • Please see example

    ex prdname price

    x 10

    y 20

    z 30

    I want to display top 2 products by price..please help me out

  • Try this

    WITH thisCTEisJustToProduceSampleData AS (

    SELECT 'x' AS ex_prdname, 10 AS price

    UNION

    SELECT 'y', 20

    UNION

    SELECT 'z',30

    )

    SELECT TOP 2 *

    FROM thisCTEisJustToProduceSampleData

    ORDER BY price DESC;

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • ohh..thanks for quick reply.

  • nandu.chowdary412 (3/10/2014)


    ohh..thanks for quick reply.

    You are welcome.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply