Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Reg - Log table data Expand / Collapse
Author
Message
Posted Monday, February 17, 2014 6:56 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, June 12, 2014 7:55 AM
Points: 12, Visits: 81
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

How it come means for first record null to open from log table(ie. start so matchid is null )
second record is open in prev stage and pending in current stage so match id is 101)
Like that i have to take result. Please help me in this.

Post #1542092
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse