Energy
-
Friday, August 03, 2012 4:50 AM
I hited this query :
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 from
Actions A where A.chsUerID = Actions.chuerID and A.Status = '5')
Group by chsuseridmy question is
Number of complaints closed by employee and reopened.... but
finally closed by another employeeStatus for reopened is = 5 and for closed it is 4
how hit the query
All Replies
-
Friday, August 03, 2012 8:49 AM
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 from
Actions A where A.chsUerID = Actions.chuerID and A.Status = '5')
Group by chsuseridWhat not exits???
-
Friday, August 03, 2012 9:23 AM
-
Friday, August 03, 2012 9:33 AM
In action tables fields are:
ACTIONID ISSUEID OLDSTATUS NEWSTATUS CHSUSERTYPE CHSUSERID CHSUSERNAME In issues tables fields are:
CHSREASONID
COMPLAINANTID OFFICERID CSCCODE DISTRIBUTORID STATUS PRIORITY
Come in two table is issues id.
Expected output:
Number of complaints closed by employee and reopened.... but
finally closed by another employeefor status column: closed '4' and reopened '5'
-
Friday, August 03, 2012 9:39 AM
Hi,
Did you read my previous post please? again: Please post your DDL along with some sample data + the expected output.
J
There are 10 type of people. Those who understand binary and those who do not.
- Edited by Janos Berke Friday, August 03, 2012 9:40 AM
-
Friday, August 03, 2012 10:02 AMOLDSTATUS 2
Action Table
ACTIONID 521779
ISSUEID 247959
NEWSTATUS 4
CHSUSERTYPE 10
CHSUSERID 4047
CHSUSERNAME M LAXMI BAI (531470)
In issues tables fields are:
ISSUEID 247959
RefrenceID 11000071(11 indicates year)
CHSREASONID 10
COMPLAINANTID 252223
CSCCODE 12752
DISTRIBUTORID 14590400
STATUS 4
PRIORITY 3for status column: closed '4' and reopened '5'
I repeat my question i want to see complaints closed by employee(eg: laxami bai(4042)) and reopened. but finally close by other employee
- Edited by star12345 Friday, August 03, 2012 10:03 AM fd
-
-
Friday, August 03, 2012 1:03 PMModerator
Can you please stop re-opening new and new threads? In your 'vanila' thread I already provided you with the query. That query is not very simple and this problem is not too simple either. Also, does any of your tables have date field? How do you define 'finally closed'? Finally closed means that the last date status is 4. However, without date field how can we know that this row is final? Or do you have any other field that dictates the order?For every expert, there is an equal and opposite expert. - Becker's Law
My blog- Marked As Answer by amber zhangModerator Monday, August 13, 2012 1:27 AM

