Jump to content

Spitting Data Based on Column Data

- - - - -

  • Please log in to reply
2 replies to this topic

#1
mayasmitha

mayasmitha

    Newbie

  • Members
  • PipPip
  • 13 posts
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
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Just write the proper sql statement?
select orderdate, orderid, sum(orderprice) from tablename where orderdate = ? group by orderid

#3
Justin Donohoo

Justin Donohoo

    Newbie

  • Members
  • Pip
  • 2 posts
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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users