Takács Zoltán Takács Zoltán - 1 month ago 8
MySQL Question

Mysql IN function dont work with text data type

In a webshop, im using filters in the sidebar, for searching products.
I can search for product status to. In the product table, the termek_allapot column is the product status, this is a varchar type column, and i store the data in this like text.

AND termek_allapot IN (Készleten) AND ( termek_kategoria = '9' AND termek_status = 1 )


The mysql in function doesnt work here, only if i search for int data.

enter image description here

I can filter for everything, but this doesnt work, because the data are text, not ID.

Answer

Try AND termek_allapot IN ('Készleten') AND ( termek_kategoria = '9' AND termek_status = 1 )