Supplier Order Gaps :Find Each Supplier's Longest Gap Between Order Dates Advanced

Find the longest time between days on which each supplier fulfilled orders.

Xorthax wants to know how long each supplier went without fulfilling an order. For each supplier, find the longest difference between days on which they fulfilled orders. Show when the gap began, when it ended, and how many days it lasted calculated as later date minus earlier date. If gaps tie for longest, return the most recent one.
Write Your Query
Next Problem →

This reflects monitoring supplier activity by finding the longest time between dates on which each supplier fulfilled orders.

You'll practice finding previous dates within groups, calculating differences between dates, and selecting the largest difference for each supplier.

This problem is labeled as Advanced. It’s intended for learners who are already comfortable with common window functions and want to push into more complex analytical patterns. Don’t rush — work through the hints one at a time and study the final query structure carefully.

Yes. Every problem comes with optional hints you can reveal one at a time, plus a fully worked step-by-step solution. You decide how much help you want while practicing.

All problems on PracticeWindowFunctions.com are completely free and can be solved without creating an account. Right now there are over 80 practice problems, with new ones added regularly.