Hi,
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:
SELECT
i.id,
i.userId
FROM
items i
LEFT OUTER JOIN statut s ON i.id = s.itemId
WHERE
CASE WHEN (
SELECT m.date
FROM modification m
WHERE m.itemId = i.id
ORDER BY m.date DESC LIMIT 1
) IS NULL THEN
i.created
END > DATE_SUB(NOW(), INTERVAL 90 DAY)
AND s. LEVEL = 1
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. Thank you for your help!