数据库设计,怎么建立下面这个数据库的设计,多个表还是一个字段多个内容?

2025-04-13 20:26:22
推荐回答(1个)
回答1:

--你的语句不对,字段中是一个字符串,你却用pic='1' and pic='2' ,pic='1'是指整个字段pic的值与1相等,
如果是表A可以写成
select user from A where pic like '%1%' and pic like '%3%' and pic like '%9%'

如果是B表可以写成
select user ,id from A left join (select typeid from B where pic='1' and pic='3' and pic='9') C on A.id=C.typeid