Find the longest streak of consecutive months in which each customer placed at least one order. A streak breaks when a customer has no orders in a month. Return customer_id and their longest_streak (in months). Sort by longest_streak descending.
Schema
🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql
Run your query to see results
Press Ctrl + Enter to execute