write a mysql query Show the customer ID their first and las
write a mysql query: Show the customer ID, their first and last name, and the date of their last payment of all those that are inactive customers sorted descending by last name and then ascending by first name. The objective you are to show here is how to use a subquery in an expression. (Hint: On the active column in the customer table, 0 means inactive and 1 means active)
Solution
Query:
SELECT ID, firstName, lastName, lastPaymentDate FROM customer WHERE active = 0 ORDER BY lastName DESC, firstName ASC;
This query will select the four columns from the customer table where active is 0 and orders them in descending order of lastname first and then ascending order of first name.
