sounds like this to me
SELECT
[SaleBegin]
,S.[EPDKLicenseCode]
,[ProductID]
,sum(case when typeid=18 then 0 else [Volume] end) as TotalVolume
FROM [PUMPOMAT_HO].[dbo].[SalesAll]
inner join stations S
on
S.RID = SalesAll.StationID
where (SaleBegin >='20130201' and SaleBegin < '20130205') and (ProductID= 22 or ProductID=23 )
group by S.[EPDKLicenseCode],SaleBegin,ProductID
please dont convert dates to varchar for formatting, do it at your front end application
If above didnt give you what you were looking for, post some sample data and your expected output
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/