Counter of Festivals

Ashok Blog for SQL Learners and Beginners and Experts

Monday 25 August 2014

To find Second largest from Sub Query without using Row_number

To find Second largest from Sub Query without using Row_number :

select * from payment
where payment_amt=(select min(payment_amt) from (select distinct top 2 payment_amt from payment order by payment_amt desc)temp)

select top 5 *  from payment
order by payment_amt desc


select COUNT(*) as count from payment

Screen shot:


No comments:

Post a Comment