To make this run all of the columns in the select have to be in the group by portion of the query.
Select B.BBarcode , Name, C.Country, Manufacturer,W.id,
Packtype, B.TovarId, sum(WCount) as count, Price, Series, ExpDate
from Warehouse W, Tovar T, Barcodes B,
Countries C
where C.CId=T.Country and
B.WarehouseId=W.id and WCount>0 and
T.id=W.TovarId +'=@param'
GROUP BY B.BBarcode , Name, C.Country, Manufacturer,W.id,
Packtype, B.TovarId, Price, Series, ExpDate
ORDER BY Name
However I’m not sure the query will run with the where syntax you have, specifically the T.id=W.TovarId +'=@param' portion.
That can be refactored to be either
T.id=W.TovarId and T.id = @param
Or
T.id=W.TovarId and W.TovarId= @param
Version that should execute
Select B.BBarcode , Name, C.Country, Manufacturer,W.id,
Packtype, B.TovarId, sum(WCount) as count, Price, Series, ExpDate
from Warehouse W, Tovar T, Barcodes B,
Countries C
where C.CId=T.Country and
B.WarehouseId=W.id and WCount>0 and
T.id=W.TovarId and T.Id = @param
GROUP BY B.BBarcode , Name, C.Country, Manufacturer,W.id,
Packtype, B.TovarId, Price, Series, ExpDate
ORDER BY Name
I would also look at some documents on how sql server does joins and the group by. While I believe sql server will do the joins correctly for an inner join between the tables based on how you’ve written them, the syntax structure they have make it a little more clear what is joining to what as well as the options to do other types of joins
GROUP BYclause. Your query will only run in MySQL. Your query won't even run in any other dbms because it just doesn't make sense.JOIN. It's been around for over 20 years.