Jump to content

mysql count problem


newphpbees

Recommended Posts

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:

 

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

Link to comment
https://forums.phpfreaks.com/topic/257456-mysql-count-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.