bemoCannon
Programmer
Hi everyone and thanks in advance.
I have two tables, one for members and one for accounts. Every member can have multiple accounts. Accounts have a lifespan, which is specified by start and end dates, and can be terminated early with a closed tinyint variable.
I want to query all the members who have no active accounts. This could me they have one active account, or no accounts at all.
I join the two tables using this:
FROM (account LEFT JOIN member ON account.Memberid = member.MemberID)
LEFT JOIN address ON account.Memberid = address.MemberID
(curdate() <= enddate AND closed = 0) //Current accounts
(curdate() > enddate AND closed <> 0) //Expired accounts
Thanks.
I have two tables, one for members and one for accounts. Every member can have multiple accounts. Accounts have a lifespan, which is specified by start and end dates, and can be terminated early with a closed tinyint variable.
I want to query all the members who have no active accounts. This could me they have one active account, or no accounts at all.
I join the two tables using this:
FROM (account LEFT JOIN member ON account.Memberid = member.MemberID)
LEFT JOIN address ON account.Memberid = address.MemberID
(curdate() <= enddate AND closed = 0) //Current accounts
(curdate() > enddate AND closed <> 0) //Expired accounts
Thanks.