Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- company_name,
- sale_date,
- total_amount,
- @rank := IF( @comp_id = company_id, @rank + 1, 1) AS day_rank,
- @comp_id := company_id AS company_id
- FROM
- company_sales
- ORDER BY
- company_id, total_amount DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement