I keep having an issue with my SQL query, and I’m not able to resolve it myself after various attempts and research.
The error:
Warning: #1292 Truncated incorrect DOUBLE value: ‘TITLE1_00’
Warning: #1292 Truncated incorrect DOUBLE value: ‘TITLE2’
Warning: #1292 Truncated incorrect DOUBLE value: ‘_00’
My query:
SELECT t1.titleid
FROM tmdb t1
LEFT JOIN patch t2
ON t1.titleid = t2.name + '_00'
WHERE t2.name IS NULL
Structure:
tmdb: titleid(varchar)(15)
patch: name(varchar15)(15)
I’ve tried:
name(varchar)(15)
was name(varchar)(9)
, and I’ve changed this to 15.
I’ve ran the query in phpmyadmin in both databases.
Does anyone know why this is happening, and what the solution is?
The question was marked as a duplicate. The answer in the linked post does not answer my question as this query is different. As mentioned in this post I’ve done research and already came across this post!
2
Answers
What’s the point of that SQL? Could you give an example of data and result what you need?
You try to add ‘_00’ to null. Isn’t it mistake in where clause?
Did you try with CONCAT(ifnull(t2.name,”),’_00′) ?
+
is numeric addition, not string concatenation… so MySQL tries to cast your values to numbers. Having no better plan, it goes for the fallback type ofDOUBLE
(64 bit floating point value). But since your strings don’t make very convincing numbers, you get warnings.The correct construct for string concatenation: