View Single Post
  #4 (permalink)  
Old 02-02-10, 00:00
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by mahendrakariya View Post
select price,title
from book as B
where ( select count(*)
from book as T
where T.price > B.price ) > 5
order by price desc

price title
60 three
50 book two
40 book1
you have proved here, yourself, that your first post was incorrect

in your first post, you said "If I do >5, it is returning the 4 most expensive books."

clearly, 60-50-40 is ~not~ the 4 most expensive

see what i mean?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote