SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with t as ( select rental_date, return_date, lag(return_date) over(order by return_date, rental_date) as prv from rental where customer_id = 1 order by return_date, rental_date ) select rental_date, return_date, prv, sum(if(rental_date > prv, 1, 0)) over(order by return_date, rental_date) as p from t

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear