/ Published in: MySQL

I use something similar to the example to get the difference between statuses in a status log table that I have. It comes in handy when determining the number of days between status changes. This works in MySQL 5.0.
Expand |
Embed | Plain Text
SELECT DATEDIFF( (SELECT DATE(date_field) FROM table WHERE id = '1' AND status_id = '2' ORDER BY date_field DESC LIMIT 1), (SELECT DATE(date_field) FROM table WHERE id = '1' AND status_id = '1' ORDER BY date_field DESC LIMIT 1) ) AS difference
Comments

You need to login to post a comment.
download best software to android root use app kingo or 360 for pc mac ios windows 10 8 1 7 xp computer https://extensions.sketchup.com/zh-TW/content/sguanci-aperture-architettoniche-parametriche