Code Block
Create Table #Request ( [requestid] int , [stateno] nvarchar(5) , [cityno] int , Callid int, UniqueNo int);
Create
Table #RequestDetail(reqdetailid int, [customername] Varchar(20), [customerage] int, requestid int);
Create
Table #Call(Callid int,Calltype int,callDetailid int )
Create Table #CallDetail(callDetailId int,empid int)
Insert
into #CallDetail VALUES(12123,1)
Insert
into #CallDetail VALUES(53423,1)
Insert
into #CallDetail VALUES(6532,1)
Insert
into #CallDetail VALUES(82323,1)
Insert
into #CallDetail VALUES(124235,1)
Insert
Into #Call VALUES(111,1,12123)
Insert
Into #Call VALUES(112,1,53423)
Insert
Into #Call VALUES(114,1,6532)
Insert
Into #Call VALUES(123,2,6532)
Insert
Into #Call VALUES(134,1,124235)
Insert
Into #request Values('324234','SA023',12,111,0);
Insert
Into #request Values('223452','SA023',12,112,0);
Insert
Into #request Values('456456','SA024',12,114,0);
Insert
Into #request Values('22322362','SA024',44,123,0);
Insert
Into #request Values('22654392','SA023',12,134,0);
Insert
into #requestdetail values(1, 'Bill',23,'324234')
Insert
into #requestdetail values(2, 'Tom',25,'223452')
Insert
into #requestdetail values(3, 'Bobby',27,'456456')
Insert
into #requestdetail values(4, 'Guck',29,'22322362')
Insert
into #requestdetail values(5, 'Bobby',33,'22654392')
1. My stored proc will take the CallDetailID.
2. I have to find out the requests made on this calldetail.
3. After getting the request, i want to take the Customername, cityno of the request/requestdetail and pass it again to #request table to search for any duplicates within the request.
4. If found return the details of the original record :
[A similar requirement was solved earlier, but the structure has changed. This is a seperate requirement with different table strucure. Hence a new post. ]
thanks