我在MySQL数据库中有以下内容
CHILDREN
|NAME |LIKES (LONGTEXT)
|Sam |75
|John |58,64,75
FRUITS
|ID |LABEL
|58 |Apple
|64 |Banana
|75 |Cherry
为了获得儿童的水果名称,我做了:
> select * from fruits where id in
(select LIKES from CHILDREN where name="Sam");
|ID |LABEL
|75 |Cherry
好的,但是
> select * from fruits where id in
(select LIKES from CHILDREN where name="John");
|ID |LABEL
|58 |Apple
我也尝试了以下相同的结果:
> select * from fruits where id in ("58,64,75")
|ID |LABEL
|58 |Apple
[Main Instruction]
Your query produced 1 warnings.
Warning: Truncated incorrect DOUBLE value: '58,64,75'
[OK]
>select * from fruits where id in (58,64,75)
|ID |LABEL
|58 |Apple
|64 |Banana
|75 |Cherry
如何解决问题无需更改表格定义以及类似的内容......