Open mmmaly opened 10 years ago
after altering, it is possible to fill the columns also for past actions
SELECT h1.*,max(h2.time) as renttime FROM history as h1 join history as h2 where h1.action="return" and h2.action="rent" and h2.bikenum=h1.bikenum and h2.time<h1.time group by h1.time order by h1.time desc LIMIT 500