I have two tables:
t1
____________
projectID
userID
projectExpiration
t2
____________
usrID
subscriptioID
subscriptionExpiration
I need to select porject ID from T1 where the following conditions are met:
t1.projectExpiration = older then 3 months
t2.subscriptioID = '5'
t2.expiration = older then 3 months
The user may have other subscriptions in t2. I need ONLY the results where they have a single subscription entry which has an ID of '5'
I need help putting it all together.
Here's what I've got so far:
SELECT projectID
FROM t1
LEFT JOIN t2 ON (t1.userID = t2.userID)
WHERE t1.projectExpiration < (CURDATE() - INTERVAL 3 MONTH)
AND t2.subscriptionExpiration = 5
AND t2.subscriptionExpiration < (CURDATE() - INTERVAL 3 MONTH)
Feel like I'm stuck...