I'm quite new with sql and hope someone can help me with the following issue; I have the following result after running my report;item_num loc Sum sls-qty-12mnth Sum sls-qty-6mnth Sum sls-qty-3mnth25025345 NON-CONFORMITY 163 83 35 XF030304 163 83 3525025346 NON-CONFORMITY 83 30 1 XK010102 83 30 1I would like to count the locations by item and divide the sum 'sls qty 12 -6 and 3 months' with the total location, in this case the result should be something like;item_num loc Sum sls-qty-12mnth Sum sls-qty-6mnth Sum sls-qty-3mnth25025345 NON-CONFORMITY 81.5 41.5 17.5 XF030304 81.5 41.5 17.525025346 NON-CONFORMITY 41.5 15 0.5 XK010102 41.5 15 0.5as you can see the sum sls qty's months gives me the grand total for both location while I would like to split this between the two locations. I'm not referring to qty by location but total locations. When I add the COUNT function to the view in order to count the location by item I get the error message all the other tables should be in aggregate or group mode. I'm working on a 2008 R2 SQL and the queries for this report are coming from 3 different views.I hope my issue is understandable does some one knows how to make a Count of the locations by item for a complete list of more than 7000 items than can be located in more than one location in SQL?;-)thank you very much in advance for any help in the good direction,
↧