Forum Moderators: open
For two given dates, I want to select all entries which occur on one date, and not on the second.
So for example, say the table is a log of visitors, and the fields are date, url, browser, ip. What I want is to select the specific url-browser-ip combinations that occur on the first date, and don't occur on the second date.
And I get lost there. Am I just making it too complicated? Is there a simpler way to describe what I'm trying to do?
Possible solutions I've gone after:
- somehow treat an entry of multiple columns as a single field, and then count the dates for which this occurs, and select those where count=1 and the date is the given one. Didn't work.
- select the group HAVING COUNT(date)=1 ... this query did run, but this returned an empty set.
SELECT * FROM test T1 LEFT JOIN (SELECT * FROM test WHERE
test.mydate='date2') T2 on T1.url=T2.url AND T1.browser=T2.browser AND T1.ip=T2.ip WHERE T1.mydate='date1' AND T2.mydate IS NULL
But you really should upgrade your mysql - that version is ancient.