How can I select just rows of newly added records, for a specific date, that have not been entered previously?
My source data is:

SELECT DISTINCT
Date, IP
FROM
tblIPs
WHERE
(Date = '2019-03-25')
This returns:

but 10.0.0.1 does exist previously in the database, so I don't want that to be in my results.
Is there any way I can select unique IP addresses, regardless of the date, and then filter them by the date, 2019-03-25?
You can use group by and having:
SELECT MIN(Date), IP
FROM tblIPs
GROUP BY IP
HAVING MIN(Date) = '2019-03-25'
So you want the IPs that appear on 2019-03-25, and don't appear before that:
SELECT IP FROM tblIPs WHERE DATE = '2019-03-25'
EXCEPT
SELECT IP FROM tblIPs WHERE DATE < '2019-03-25'
;
If you also want to exclude IPs that appear again after 2019-03-25, change the < to <>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With