water
-
Thursday, August 02, 2012 7:04 AM
I hited
select chsuerid, count(*) from issues inner join actions on actions.issueid
= issues.issueid where chsuserid ='4042'and refrenceid like'11%' and [Status]='4' and not exists(select 1 from
Actions A where A.chsUerID = Actions.chuerID and A.Issueid=actions.issueid and A.Status='5')
Group by chsuseridmy question is
Number of complaints closed by employee and reopened.... but
finally closed by another employeestatus for close it is '4' and for reopened it's ='5'
how we can jit query for above question please help soon
All Replies
-
Thursday, August 02, 2012 8:14 AMAnswererPlease post sample data + desired result.
Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
-
Thursday, August 02, 2012 8:32 AM
There are two tables:
In action tables fields are:
ACTIONID ISSUEID OLDSTATUS NEWSTATUS CHSUSERTYPE CHSUSERID CHSUSERNAME In issues tables fields are:
CHSREASONID
COMPLAINANTID OFFICERID CSCCODE DISTRIBUTORID STATUS PRIORITY -
Thursday, August 02, 2012 8:43 AMAnswerer
It does not help.... Please post CREATE TABLE ..+INSERT INTO data for testing.Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
- Proposed As Answer by Ed Price - MSFTMicrosoft Employee, Owner Sunday, December 30, 2012 9:02 AM
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Monday, January 07, 2013 11:51 AM

