Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT code, model, color, type, price,
- MAX(model) OVER(PARTITION BY partition ORDER BY code ASC),
- AVG(price) OVER(PARTITION BY partition ORDER BY code ASC)
- FROM
- (
- SELECT *,
- CASE
- WHEN color = 'n'
- THEN 1
- ELSE 0
- END AS partition
- FROM printer
- ) t
- ORDER BY code ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement