SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reg - Log table data


Reg - Log table data

Author
Message
vinodhkumargv
vinodhkumargv
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 87
Hi Friends ,

I have two table like log table and main table as below

LOG TABLE
ID PREVSTATUS CURR STATUS
1 NULL Open
1 Open Pending
1 Pending Open
1 Open OpenRequest
1 OpenRequest Closed

MAIN TABLE
ID PREVSTATUS CURR STATUS MATCHID
1 Open Open NULL
1 Open Open 100
1 Pending Pending 101
1 Open Open 102
1 Open OpenRequest 103
1 Closed Closed 104
1 Closed Closed 104
1 Closed Closed 106

and i want the result like

RESULT ID MATCHID
1 NULL
1 101
1 102
1 103
1 104
GilaMonster
GilaMonster
SSC Guru
SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)

Group: General Forum Members
Points: 89381 Visits: 45284
Duplicate. No replies to this please. Direct replies to http://www.sqlservercentral.com/Forums/Topic1542092-391-1.aspx

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search