*PROBABLY* this means that jpgId
in the sales
table is not the same data type as id
in the images
If you had shown the SCHEMA of the two tables, instead of a (mostly useless) data dump I could tell you for sure.
In any case, that's an inefficient way to do that.
SELECT I.* FROM images AS I, sales AS S WHERE I.id = S.jpgid AND S.printed = 0
would be much better.
But that will still give you a type mismatch if ID and jpgId are not the same datatype.
I would *guess* that ID is declared as auto_increment primary key
which means that jpgId
should be declared as int
It's also possible that printed
is not an int
field, which it needs to be if you are going to compare it to the number 0.