I need to write a query to pull out the records as below.
membership_id,
person_id,
first_name
last_name
who joined or called yesterday and the members who didn't join will have only person_id
But the below query is pulling out all the records from the table.
SELECT
dbo.pn_membership.membership_id,
dbo.pn.person_id,
dbo.pn.first_name,
dbo.pn.surname,
dbo.pn.create_datetime
FROM
dbo.pn
LEFT OUTER JOIN
dbo.pn_membership
ON dbo.pn.person_id=dbo.pn_membership.person_id AND
dbo.pn.create_datetime >=getdate()-1
I need the records only for the day before the run date.