• From what I understood you need something like this:

    SELECT a.*

    FROM sales_log_tbl a

    LEFT

    JOIN membership_record_tbl b ON a.member_id = b.member_id

    AND a.company_id = b.company_id

    AND a.purchase_dt >= b.membership_effective_dt

    AND a.purchase_dt < b.membership_term_dt + 1 --Do you know why you should use this?

    WHERE b.member_id IS NULL

    I remember there are other ways you can do this but this is one way to accomplish.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2