mysql - SUM of all, but COUNT of unique, in one query -


i have 2 queries

   select sum(amount) amount sales    select count(id) total sales group rep_id 

how can combine these 2 queries one? if group on first adds grouped amounts.

try this:

select sum(amount) amount,(select count(id) total sales group rep_id) sales


Comments