MySQL: Error Code: 1292. Truncated incorrect DOUBLE value
You missed in the where clause a comparing column
Use this instead
CREATE FUNCTION PattyTest(BunCode INT)
RETURNS VARCHAR(5) DETERMINISTIC
DECLARE Result VARCHAR(5);
IF BunCode NOT IN (SELECT B.ID
FROM BurgerOrder BO JOIN Patties P JOIN Buns B
ON B.ID = BO.BunID AND P.ID = B.PattyID
WHERE B.Type = 'sourdough' OR P.Type = 'Grilled Chicken' or P.Type = 'Beef')
THEN SET Result = TRUE;
ELSE SET Result = FALSE;
Select Query: Error Code 1292 - Truncated incorrect DOUBLE value
I don't think its the error thats the problem since you did varchar, maybe check your python code?
getting warning of 1292 Truncated incorrect DOUBLE value using IN operator in mysql
I suspect that
sale_invoice.items is a string containing comma separated integer values.
If this is the case then
IN does not work.
Use the function
WHERE FIND_IN_SET(job_details.id, sale_invoice.items)
sale_invoice.items contains spaces between the items, you must remove them:
WHERE FIND_IN_SET(job_details.id, REPLACE(sale_invoice.items, ' ', ''))