2

I am fire this sql query and then return this error.

My Error:

1292 Truncated incorrect DOUBLE value: '1,2,3,4,5,6,7,122,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,157,153,154,155,156' The SQL being executed was:

My Query:

DELETE FROM groups_module_actions 
WHERE module_action_id NOT IN('1,2,3,4,5,6,7,122,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,157,153,154,155,156') AND group_id='1'
Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
Bharat Chauhan
  • 3,204
  • 5
  • 39
  • 52

1 Answers1

2

Skip the quotes in the NOT IN (), its expecting datatype integer not a string.

DELETE FROM groups_module_actions WHERE module_action_id 
NOT IN(1,2,3,4,5,6,7,122,8,9,10,11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,157,153,154,155,156) 
AND group_id=1
Strawberry
  • 33,750
  • 13
  • 40
  • 57
Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
  • For reasons around implicit conversion, quoted numbers result in the comparison being compared as a double. So don't quote numbers that are no being compared against strings (e.g. phone numbers). – danblack Jan 21 '19 at 21:05