EDITED: In my Database table, I have 4 column ID ,Action, Name and DateTime with below records:
Action Name DateTime
Submit AA 'date time'
Update BB 'date time'
Save CC 'date time'
Match DD 'date time'
Submit EE 'date time'
Submit FF 'date time'
Update GG 'date time'
Approve HH 'date time'
Approve II 'date time'
Update JJ 'date time'
Match KK 'date time'
Save LL 'date time'
Match MM 'date time'
etc 'date time'
etc 'date time'
These records can be repeate multiple time.
I want to select the Name and DateTime from above Table that has Action = Submit and Action = Update; into two separate columns using select query(Just like we get the data using select query).
Example Query:
SELECT Name as SubmitterName , DateTime AS SubmitterDateTime FROM [tbl_WorkflowHistory] Where Action = 'Submit'
SELECT Name as UpdateName , DateTime AS UpdateDateTime FROM [tbl_WorkflowHistory] Where Action = 'Update'
only thing is I want to show the records of both the query together but in 4 separate columns, like below Format:
Output Needed:
SubmitName SubmitDateTime UpdateName UpdateDateTime
AA 'datetime' BB 'datetime'
EE 'datetime' GG 'datetime'
FF 'datetime' JJ 'datetime'
etc etc
Under "SubmitName" column, all Names shall come that has Action=Submit along with there respective DateTime in SubmitDateTime column.
Similarly, under "UpdateName" column, all all Names shall come that has Action=Update along with there respective DateTime in UpdateDateTime column. I dont know how to write this query, its just sample to explain my requirement.
And after selecting records like above Output, using sql query, I have to display it in a RadGrid in which data coming inside "SubmitDateTime" column have to show separately (Date separate , Time separate) in 2 different columms of RadGrid i.e., SubmitDate, SubmitTime. Similarly for "UpdateDateTime" i.e., UpdateDate, UpdateTime; as described as Below:
SubmitAction SubmitDate SubmitTime UpdateAction UpdateDate UpdateTime
Submit 'date' 'time' Update 'date' 'time'
Submit 'date' 'time' Update 'date' 'time'
Submit 'date' 'time' Update 'date' 'time'
etc
I hope I made my requirement clear. Please let me know how to do this. I am using SQL server database. Please reply. Thanks in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire