View Full Version : SQL Server help needed please?


DarkSun
07-14-2011, 11:18 PM
Below i have the sql i have written the problem is when i run this data it is returning the same data multiple times, unfortunatly i cannot upload the data sheets, however the basic steps are i want to return a list of companies (grouped) against the countries sold to with the sales figures eg:

Mcdonalds UK £350,00
Mcdonalds US £499,00
Extra PL £230,000
etc............................
however when i run the below it will return Mcdonalds UK etc.... numerous times?
im new to sql so please forgive me if this makes no sence.

select c.company,sum(RevenueGBP)Sales,sum(CostG…
from Fact_shippedorders a
inner join Product_Dim b on idProduct = Item
join tblbr_Sales_all c on idsalesorder = DocNo
where Manufacturer in ('McDonalds US','McDonalds UK','Extra UK')
and b.GL_Rev_desc = 'Sales - Authorised'
and idInvoicedDate between '20100401' and '20110331'
group by c.company,Manufacture