I'd get to do a join query with 3 (sometimes 2).
Here is the structure of my 3 tables in question:
items> id, cat, subcategory, created
status> itemId, level
Modify> id, itemId, date, type
Here's my query so far:
I would like to get a look at what the last change add and see if it has been over 90 days. In case no change was made compared with the creation date of the item. He that can strongly that there are several changes to a single item so it should really checked with the last added in case there.
LEFT OUTER JOIN statut s ON i.id = s.itemId
CASE WHEN (
FROM modification m
WHERE m.itemId = i.id
ORDER BY m.date DESC LIMIT 1
) IS NULL THEN
END > DATE_SUB(NOW(), INTERVAL 90 DAY)
AND s. LEVEL = 1
Thank you for your help!