MySQL multiple likes with and

66 views Asked by At

Using MySQL:

SELECT * FROM Transactions WHERE userID = 4 and month(date)>11 and cat2 regexp '%gas stations%|%food%|%restaurants%'

I'm trying to get the transactions for user 4, in the month of December, that have the three values listed for category 2 (cat2). I am getting those transactions that I want but am also getting transactions in all other months that have the three corresponding category 2s. How can I filter all of those out?

0

There are 0 answers