Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Development (http://www.go4expert.com/forums/web-development-forum/)
-   -   mysql count problem (http://www.go4expert.com/forums/mysql-count-problem-t27849/)

newphpcoder 21Feb2012 16:18

mysql count problem
 
Good day!
Hi,
I encountered problem in Count.
I have this data:

REFNUM----LOT_CODE----PCODE--wip_chemicalweighing--wip_compounding-------wip_extrusion--wip_forming--wip_deflashing
000001----000001P35M--P35M---0.00------------------0.00------------------0.00-----------0.00---------40.00---------
000002----000002P35M--P35M---73.30-----------------NULL------------------NULL-----------NULL---------NULL---------
and I have this code:
Code:

SELECT PCODE, COUNT(LOT_CODE) AS lot_chemicalweighing, COUNT(wip_chemicalweighing + wip_compounding + wip_extrusion + wip_forming + wip_deflashing) AS virtual FROM kanban_data WHERE wip_chemicalweighing != '0.00' OR 'NULL' AND wip_compounding != '0.00' OR 'NULL' AND wip_extrusion != '0.00' OR 'NULL'AND wip_forming != '0.00' OR 'NULL' AND wip_deflashing != '0.00' OR 'NULL' GROUP BY PCODE;
And the output of this code is :
PCODE-- lot_chemicalweighing---virtual----
P35M----1----------------------0--------
the lot_chemicalweighing is correct but the virtual is wrong, because it should be 2 because I have 1 data in wip_chemicalweighing and 1 in wip_deflashing.
Thank you


All times are GMT +5.5. The time now is 20:28.