March 10, 2014 at 11:09 am
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
March 10, 2014 at 11:16 am
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
March 10, 2014 at 11:18 am
ohh..thanks for quick reply.
March 10, 2014 at 11:24 am
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