I have have a query that returns sales total per vendor and location. How would I add a column for percentage of total sales for the date selected. Using sql 2005
SELECT vendor,
location,
sum(ExtPrice) as total
FROM [database].[dbo].[GetOrderDetails]
where processdate > '2010-05-08 16:35:46.500'
group by vendor,location
order by vendor asc
You would want your code to look like the below, using a computed column
you could possibly use total in place of the sum(ExtPrice), but I’m not certain you can target another computed column. worth a shot though