J
jroth
My dataset has 3 columns: customer id, store location, charges
I'd like to write a single select statment that will show each customer id
once, with the store location where they have the most charges, and the sum
of the charges for that store location.
This gives the max charges for each customer, but doesn't give the location:
select a.custID, max(new.amt) from smallchg a inner join;
(select custID, location, sum(charges) as amt from smallchg group by custID,
location) as new ;
on a.custID= new.CustID group by a.CustID
thanks.
joel
I'd like to write a single select statment that will show each customer id
once, with the store location where they have the most charges, and the sum
of the charges for that store location.
This gives the max charges for each customer, but doesn't give the location:
select a.custID, max(new.amt) from smallchg a inner join;
(select custID, location, sum(charges) as amt from smallchg group by custID,
location) as new ;
on a.custID= new.CustID group by a.CustID
thanks.
joel