tags:

views:

17

answers:

0

I have got two tables 1.ItemsSoldOnShop, 2.ItemSoldOnInternet. Each has partNo, quantity, date, etc fields. All I want is to sum total quantity sold for a given partNo and date range in two different Linq to SQL quaries in vb.net 2008 1. Monthly sum 2. Just total quantity. I dont need to look at master table which is PartMaster. I did few search, but I didnt find any information other than the following sample sql query. If this query can be converted into linq to sql vb.net, will be pleased.

SELECT MONTH_REF, SUM(amount1), SUM(amount2)
FROM (
SELECT MONTH_REF, SUM(amount1) AS amount1, SUM(amount2) as amount2
FROM T_FOO
WHERE seller = XXX
GROUP BY MONTH_REF
UNION ALL SELECT MONTH_REF, SUM(amount1), SUM(amount2)
FROM T_BAR
WHERE seller = XXX
GROUP BY MONTH_REF
) tmp
GROUP BY MONTH_REF

Thanks

Michael