1

Query :

SELECT event_time, user_host, argument 
FROM mysql.general_log 
WHERE event_time > ('2016-08-04 10:50:27') 
AND user_host LIKE 'vareity_1_1%' 
OR user_host LIKE 'db_tvm%'

enter image description here

The query is working but am records which doesn't satisfy the where clause. Here in the image you can see the results got

closed as unclear what you're asking by Philᵀᴹ, Michael Green, dezso, ypercubeᵀᴹ, mustaccio Aug 4 '16 at 12:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

AND has higher precedence than OR. Your query, without parentheses, is equivalent to this:

SELECT event_time, user_host, argument 
FROM mysql.general_log 
WHERE (event_time > '2016-08-04 10:50:27' AND user_host LIKE 'vareity_1_1%')
   OR user_host LIKE 'db_tvm%' ;

Try this instead:

SELECT event_time, user_host, argument 
FROM mysql.general_log 
WHERE event_time > '2016-08-04 10:50:27' 
 AND (user_host LIKE 'vareity_1_1%' OR user_host LIKE 'db_tvm%') ;

Not the answer you're looking for? Browse other questions tagged or ask your own question.