MySQL: Error Code: 1292. Truncated incorrect DOUBLE value
You missed in the where clause a comparing column
Use this instead
DELIMITER //
CREATE FUNCTION PattyTest(BunCode INT)
RETURNS VARCHAR(5) DETERMINISTIC
BEGIN
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;
END IF;
RETURN Result;
END //
DELIMITER ;
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 FIND_IN_SET()
:
WHERE FIND_IN_SET(job_details.id, sale_invoice.items)
If sale_invoice.items
contains spaces between the items, you must remove them:
WHERE FIND_IN_SET(job_details.id, REPLACE(sale_invoice.items, ' ', ''))
Related Topics
Sql: How to Get Both Match and Non-Match Records
What Is and How to Remove Tablespace Error from My Database
Regex Pattern Inside SQL Replace Function
How to Extract Part of a String in Hive
Phpmyadmin Says No Privilege to Create Database, Despite Logged in as Root User
Mysql Workbench Edit Table Data Is Read Only
Ssis Date in Derived Column as Yyyy-Mm-Dd Format
How to Subtract One Day from Current Date Then Convert to String in Hive
Reactjs Connection With Database
Copy and Insert to Same Table No Duplication and With Minor Changes to Value
Replace Default Null Values Returned from Left Outer Join
Joining Tables from Different Servers
Get Last Record of a Table in Postgres
Sql: Update Column With Increment Numbers Based on 2 Columns
Check If a Column Contains Text Using SQL