I am creating a mock e-commerce database for testing a script; I want to run the following code, but also inclued a further statement to select the cards based on expiry date.
SELECT customerCard.cardNumber, customer.firstName, customer.eMailAddress, customer.lastName, cardType, expiryDate
FROM customerCard
LEFT JOIN customer
USING ( eMailAddress )
LEFT JOIN card
USING ( cardNumber )
WHERE card.Expiry =< DATE_FORMAT(NOW(),'%m-%Y')
ORDER BY `customerCard`.`cardNumber` ASC
I get an error on the line with the WHERE statement – how can I fix this? What is the correct syntax?
I have figured out the correct MySQL query statement from your help above.