关于查询和表结构
这里有两张表product(产品表)和tool(工具表),一个产品会有多个对应的工具属性,我在product表里存了一个字段tool_id,里面存的是多个tool_id(这样的:1,2,3),但是我发现这样关联查询
(sql:select * from product a left join tool b on b.id in (a.tool_id)。发现类似于这样查 select * from tool where id in ('1,2,3') 而不是 select * from tool where id in (1,2,3))
只显示出来第一个结果(比如 tool_id存的是1,2,3只显示tool表里的1。2,3显示的则是tool表里的2),
难道只能在建一张关联关系表了么,boos一直在要求精简表的数量,,,如果写两句sql,感觉有好不爽