MY homework requires “Via a single SELECT query display the total
MY homework requires “Via a single SELECT query display the total
count of sales, by model and then by zip code, with the
highest values first”.
I can produce the information on 2 separate select inquiries, but cannot find a way to produce the required output all together. I have attached a sample of my code below, when i execute it shows duplicated of model. when i run each inquiry separate it shows exactly what i need.
select *
from(
select model, count(*) as “Sales by Model”
from vehicles
inner join sales
on sales.vin=vehicles.vin
group by vehicles.model
order by count(vehicles.model) desc),
(
select zip, count(*) as “Sales by Zip”
from customers
inner join sales
on sales.cust_id=customers.cust_id
group by customers.zip
order by count(customers.zip) desc)