3 ms·
Wouldn't SELECT * FROM (SELECT DENSE_RANK() OVER ( PARTITION BY sd1.sale_person_id ORDER BY sd1.no_products_sold DESC) r ,sd1.sale_person_id ,sd1.sale
by croes 4y ago
Wouldn't
SELECT * FROM
(SELECT
DENSE_RANK() OVER ( PARTITION BY sd1.sale_person_id ORDER BY
sd1.no_products_sold DESC) r
,sd1.sale_person_id
,sd1.sale_person_name
,sd1.no_products_sold
,sd1.commission_percentage
,sd1.sales_department
FROM sales_department_details sd1) sd
Where sd.r = 1
do the same without the inner join?
- rjh29 4y agoYes, you actually know SQL, unlike other people who don't even know window functions exist.
- fny 4y agoDENSE_RANK is not ANSI SQL, also you're implicitly performing a join with your "where" clause.
- trimethylpurine 4y agoWhich SQL engine supports none but ANSI key words? You're implicitly commenting in binary, but you didn't have to do any math.