Mysql
 sql >> Database >  >> RDS >> Mysql

MySQL LEFT JOIN Query con clausola WHERE

Vuoi spostare il controllo della data nella posizione della query interna.

Prova qualcosa come:

SELECT member.*,card.* 
FROM member 
LEFT JOIN member_card card on card.member=member.id
WHERE member.id IN (
    SELECT DISTINCT m.id FROM Member m
        LEFT JOIN Member_Card mc ON (mc.Member = m.id)
        WHERE ( m.LastModifiedDate >= sinceDate  
        OR mc.LastModifiedDate >= sinceDate ) 
)