Let's say you have a table with user, url, datetime, in which each row is a website visit.
How to find users who have visited both an URL contaning string pattern A and visited an URL containing string pattern B?
The fact it's "containing a string pattern ...", and not a simple equality makes it impossible to use a query with something like
url in ('action1.php', 'action2.php')
like in SQL querying a customer ID who ordered both product A and B.
You can use
group byandhaving:If you don't want to repeat the comparisons, you can leave out the
whereclause or use: