I have a Data like below.
OrderDate OrderID TotalOrderPrice
1/10/2010 ABC 100
1/10/2010 ABC 200
1/20/2010 ABC 150
1/26/2010 ABC 100
1/10/2010 EDF 200
1/20/2010 EDF 110
1/26/2010 EDF 120
I want the final output so that I can see how much is the Sum of OrderPrice for the particular OrderID On a partucular OrderDate as shown below
OrderDate ABC EDF
1/10/2010 300 200
1/20/2010 150 110
1/26/2010 100 120
Can anyone guide me on how to achieve this? How can I query the DataTable to get this result?
Thanks & Regards
2 replies to this topic
#1
Posted 14 February 2012 - 02:52 AM
|
|
|
#2
Posted 14 February 2012 - 03:34 AM
Just write the proper sql statement?
select orderdate, orderid, sum(orderprice) from tablename where orderdate = ? group by orderid
select orderdate, orderid, sum(orderprice) from tablename where orderdate = ? group by orderid
#3
Posted 15 February 2012 - 04:20 PM
Can you explain more... where is the source data located? Is this data out of a SQL table? If so the answer given by wim DC should help you out.
If you've parsed a text file into a datatable, I'd suggest looking into DataTable.Select(). There are plenty of examples online that should point you in the right direction.
Another option is to use LINQ to DataSet to query your DataTable
If you've parsed a text file into a datatable, I'd suggest looking into DataTable.Select(). There are plenty of examples online that should point you in the right direction.
Another option is to use LINQ to DataSet to query your DataTable
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









