I have a query like below:
select *
from
(select
centre_name, sum(qty) as number1
from
(select
exchange_from_centre_id as cenid,
count(exchange_from_centre_id) as qty
from
as2.exchange
group by
exchange_from_centre_id
union all
select
exchange_to_centre_id as cenid,
count(exchange_to_centre_id) as qty
from
as2.exchange
group by
exchange_to_centre_id), as2.centre c
where
c.centre_id = cenid
group by
centre_name);
and this is the result: Name of the centre and the number of exchange
Alice Springs Desert Park 1
Werribee Open Range Zoo 6
Kruger National Park 2
Johannesburg Zoo 4
Australia Zoo 2
SanWild Wildlife Sanctuary 5
I like to select the max value from this result (the 2nd row), beside sorting and choosing the 1st row, could anyone help me with the MAX query.