Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
$stridnex = "SELECT a.department, COUNT(DISTINCT b.issue_id) as OPEN , COUNT(DISTINCT a.issue_id) as CLOSE FROM ims_job a , ims_job b WHERE a.status = '0' AND b.visible_ <> '0' AND a.visible_ <> '0' GROUP BY a.department";

output

[{"department":"","OPEN":"187","CLOSE":"7"},{"department":"Admin","OPEN":"187","CLOSE":"13"},{"department":"BU Operations","OPEN":"187","CLOSE":"1"},{"department":"Business Development","OPEN":"187","CLOSE":"8"},{"department":"Credit and Collection","OPEN":"187","CLOSE":"5"},{"department":"Finance","OPEN":"187","CLOSE":"1"},{"department":"Human Resource","OPEN":"187","CLOSE":"23"},{"department":"ICT-MIS","OPEN":"187","CLOSE":"6"},{"department":"Medical Affairs","OPEN":"187","CLOSE":"2"},{"department":"NurtureMed","OPEN":"187","CLOSE":"1"},{"department":"Operations","OPEN":"187","CLOSE":"7"},{"department":"Quality Management","OPEN":"187","CLOSE":"8"},{"department":"Sales","OPEN":"187","CLOSE":"4"},{"department":"Trade Marketing","OPEN":"187","CLOSE":"1"}]

What I have tried:

I got a problem in OPEN column, while i got the correct output for close column. can you help me with this? Im using mysql. and will use my json for moris chart.
Posted
Updated 28-Nov-16 9:53am

1 solution

Your join doesn't include any connection between the two ims_job tables (a and b). It might work to put "and a.department = b.department".

Brent Hoskisson
 
Share this answer
 
Comments
Maciej Los 28-Nov-16 16:21pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900