I have a query that starts like this...

SELECT COUNT(A.FISH), COUNT(B.MEAT), COUNT(C.FRUIT)....

now my problem is this, how could I count when I need to consider an expiration date for each column,...and the expiration dates varies for each column...

Can I do this in one query?

Or is there any other way I can do to consider the dates for each column?????.....

Need clarification here...

Thank you in advance....

SELECT SUM(IF(A.ExpirationDate < NOW(), 1, 0))

If the expiration date of the record is before today add 1, else add 0.

thank you for your reply...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.