how to convert sql union to linq
Posted
by lowlyintern
on Stack Overflow
See other posts from Stack Overflow
or by lowlyintern
Published on 2010-04-30T11:40:49Z
Indexed on
2010/04/30
11:47 UTC
Read the original article
Hit count: 267
I have the following Transact SQL query using a union. I need some pointers as to how this would look in LINQ i.e some examples wouldbe nice or if anyone can recommend a good tutorial on UNIONS in linq.
select top 10 Barcode, sum(ItemDiscountUnion.AmountTaken) from
(SELECT d.Barcode,SUM(AmountTaken) AmountTaken
FROM [Aggregation].[dbo].[DiscountPromotion] d
GROUP BY d.Barcode
UNION ALL
SELECT i.Barcode,SUM(AmountTaken) AmountTaken
FROM [Aggregation].[dbo].ItemSaleTransaction i
group by i.Barcode) ItemDiscountUnion
group by Barcode
© Stack Overflow or respective owner