Help combing rows to columns
-
I am not sure if this is going to work but figure I mine as well try. I have a query that returns 2 columns and x rows. What I want to do is join simalar rows into the columns but not sure how I can get it done.... Example Id Price 7812 25 7812 34 7813 67 7813 32 What I want to do is have the rows with the same Id show the 2 prices in the same row. Is this at all possible? Thanks for all of your help! :-D
There are 10 kinds of people in this world. Those who understand binary and those who don't. We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
-
I am not sure if this is going to work but figure I mine as well try. I have a query that returns 2 columns and x rows. What I want to do is join simalar rows into the columns but not sure how I can get it done.... Example Id Price 7812 25 7812 34 7813 67 7813 32 What I want to do is have the rows with the same Id show the 2 prices in the same row. Is this at all possible? Thanks for all of your help! :-D
There are 10 kinds of people in this world. Those who understand binary and those who don't. We shouldn't assume something's debugged just because everyone in the whole world has access to the source code.
Only manually. Add prices as strings with separator ... use hashtable as intermediate Hashtable ht=new Hashtable(1); foreach(DataRow dr in myTable.Rows) if(ht.Contains(dr["id"]) ht[dr["id"]]=ht[dr["id"]].ToString()+","+dr["price"].ToString(); else ht.Add(dr["id"],dr["price"].ToString(); Next, clear DataTable and copy Hashtable into it. Not tested Hi, AW