Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. SELECT
  2. company_name,
  3. sale_date,
  4. total_amount,
  5. @rank := IF( @comp_id = company_id, @rank + 1, 1) AS day_rank,
  6. @comp_id := company_id AS company_id
  7. FROM
  8. company_sales
  9. ORDER BY
  10. company_id, total_amount DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement