SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
SELECT customer_id, DATE_FORMAT(MIN(payment_date), '%Y-%m-%d') AS first_payment_date, DATE_FORMAT(MAX(payment_date), '%Y-%m-%d') AS last_payment_date, SUM(amount) AS total_paid FROM sakila.payment GROUP BY customer_id ORDER BY total_paid DESC, customer_id ASC; ; show status like 'Last_query_cost';

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear