Hi Guys,
Basically I have a query that is suppose to do this:
It is to pull up four columns from the database that are Date, SIN, Phone Number, Address. The database can have many different dates, phone numbers, addresses for one SIN so the database will have the same SIN in different rows. What I want to do is pull the most recent SIN record that is older than today and that has an empty value in Phone Number or "416-555-5555."
What I have so far is
SELECT DISTINCT Table1.Date, Table1.SIN, Table1.[Phone Number], Table1.Address
FROM Table1
WHERE (((Table1.Date)<Date()) AND ((Table1.[Phone Number]) Is Null)) OR (((Table1.[Phone Number])="555-555-5555"));
The problem with this is that I still get duplicate SINs since it is looking for all SINs older than today that have had a record entry when I only want the most recent SIN record older than today and not all the past records for the same SIN.
Basically I have a query that is suppose to do this:
It is to pull up four columns from the database that are Date, SIN, Phone Number, Address. The database can have many different dates, phone numbers, addresses for one SIN so the database will have the same SIN in different rows. What I want to do is pull the most recent SIN record that is older than today and that has an empty value in Phone Number or "416-555-5555."
What I have so far is
SELECT DISTINCT Table1.Date, Table1.SIN, Table1.[Phone Number], Table1.Address
FROM Table1
WHERE (((Table1.Date)<Date()) AND ((Table1.[Phone Number]) Is Null)) OR (((Table1.[Phone Number])="555-555-5555"));
The problem with this is that I still get duplicate SINs since it is looking for all SINs older than today that have had a record entry when I only want the most recent SIN record older than today and not all the past records for the same SIN.
Last edited: