Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2008-09-08 : 02:35:22
|
| Hi,My Table Structure is MyTable(Order_id,Order_date,Purchased date,Status)And My output must be as below---------------------------------Order date|Purchased date|Status---------------------------------6/7/2008 |11/7/2008 |Completed --------|--------- |Completed --------|--------- |Completed12/7/2008 |15/7/2008 |In-progress --------|--------- |In-progress--------------------------------------How to get output as aboveie, OrderDate and Purchase date should not repeat,only status have to repeat, ie, order date and purchase date must show empty for second time....ThanksGaneshSolutions are easy. Understanding the problem, now, that's the hard part |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-08 : 03:07:45
|
quote: Originally posted by ganeshkumar08 Hi,My Table Structure is MyTable(Order_id,Order_date,Purchased date,Status)And My output must be as below---------------------------------Order date|Purchased date|Status---------------------------------6/7/2008 |11/7/2008 |Completed --------|--------- |Completed --------|--------- |Completed12/7/2008 |15/7/2008 |In-progress --------|--------- |In-progress--------------------------------------How to get output as aboveie, OrderDate and Purchase date should not repeat,only status have to repeat, ie, order date and purchase date must show empty for second time....ThanksGaneshSolutions are easy. Understanding the problem, now, that's the hard part
Where do you want to show this output?MadhivananFailing to plan is Planning to fail |
 |
|
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2008-09-08 : 03:14:44
|
| Hi I got solution Insert Into MyOrder Select 1,'02/08/08','02/10/08','Completed' Union AllSelect 2,'02/09/08','02/15/08','Completed' Union AllSelect 3,'02/12/08','02/13/08','Completed' Union AllSelect 4,'02/12/08','02/14/08','Completed' Union AllSelect 5,'09/07/08','09/14/08','In Progress' Union AllSelect 6,'09/08/08','09/14/08','In Progress' Union AllSelect 7,'09/08/08','09/14/08','In Progress' Union AllSelect 8,'02/08/08','02/10/08','Completed' Union AllSelect 9,'02/09/08','02/15/08','Completed' Union AllSelect 10,'02/12/08','02/13/08','Completed' Union AllSelect 11,'02/12/08','02/14/08','Completed' Union AllSelect 12,'09/07/08','09/14/08','In Progress' Union AllSelect 13,'09/08/08','09/14/08','In Progress' Union AllSelect 14,'09/08/08','09/14/08','In Progress'Select * into #Temp From(Select Row_Number() Over(PARTITION BY OrderDate,PurchaseDate,Status Order By Status) As RowNum,convert(varchar,OrderDate,103) As 'OrderDate',convert(varchar,PurchaseDate,103) As 'PurchaseDate',StatusFrom MyOrder)AUpdate #Temp Set OrderDate='',PurchaseDate=''Where RowNum>1Select OrderDate,PurchaseDate,Status From #TempDrop Table #TempSolutions are easy. Understanding the problem, now, that's the hard part |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-08 : 03:25:10
|
| But you haven't answered to my question. This is the formation and should be done in the Front end applicationMadhivananFailing to plan is Planning to fail |
 |
|
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2008-09-08 : 03:51:59
|
| madhivanan, i want to show output in asp.net..Solutions are easy. Understanding the problem, now, that's the hard part |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-08 : 04:44:21
|
quote: Originally posted by ganeshkumar08 madhivanan, i want to show output in asp.net..Solutions are easy. Understanding the problem, now, that's the hard part
Then you should do this formation when you show data in Grid.With the formation done at backend, how can you identity rows that belong to order date 6/7/2008?MadhivananFailing to plan is Planning to fail |
 |
|
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2008-09-08 : 05:19:01
|
| i wont do any thing in front end, i just bind the data which i got from back end..Solutions are easy. Understanding the problem, now, that's the hard part |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-08 : 05:27:04
|
quote: Originally posted by ganeshkumar08 i wont do any thing in front end, i just bind the data which i got from back end..Solutions are easy. Understanding the problem, now, that's the hard part
If it is only for display then no problemBut keep in mind that it is more effecient to do this in front endMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|