Lets say I have a table of: order_id
, agent_name
, order_amount
.
order_id | agent_name | order_amount |
---|---|---|
1 | Justin | 500 |
2 | Justin | 500 |
3 | Justin | 1000 |
4 | Justin | 1000 |
5 | Pablo | 750 |
6 | Dinesh | 500 |
How would I write a query to apply DISTINCT not only on agent_name
but also on order_amount
? Basically want it to return [Justin, 500] and [Justin, 1000] once only. Is it something like the below:
SELECT DISTINCT agent_name,
DISTINCT order_amount
FROM table
2
Answers
The query goes like this:
Hope this helps. Thanks.
You can simply use
DISTINCT
applies to all columns listed in select.