How do I group by with Union
Posted on 2010-11-08
I need to show in a DataGridView (in Vb.NET) a grid like this one:
Number Description Year Per1 Per2 Per3
0001 Test 2010 100$ 50$ 75$
2009 45$ 10$ 80$
2011 39$ 70$ 110$
0002 Test2 2010 (and so on)
So to explain more the query, for Each Number i Need 3 rows. The first Row is the year that the user choose inside a combox, then the 2 next rows is the last year of the value chosen and the 3rd is the next year.
the $ values are inside a table.
My problem is that I think I need to do UNION so that it can retreive 3 rows but I dont understand how I can Group By Number (After doing an UNION)
any ideas ?