求一SQL语句,谢谢! A表一字段 Col_a 取值 True/False ,对应在 B表及 C表为 Col_b,Col_c想得到 A表中 所有对应在 B,C 中为 True 的记录。(映射关系 A.id=B.id=C.id)亦即,只要 Col_b = true 或 Col_c = true 就选出 A 表对应记录 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select A.* from Aleft join B on a.id=b.idleft join c on a.id=c.idwhere b.col_b='true' or c.col_c='true' select * from A where exists(select 1 from B where Col_b=A.Col_a) or exists(select 1 from C where Col_c=A.Col_a) select a.*from a left join b on a.id = b.id left join c on a.id = c.idwhere b.col_b = 'true' or c.col_c = 'true' 本帖最后由 roy_88 于 2011-02-23 14:30:58 编辑 select a.* from a left join b on a.id = b.id where b.col_b = 'true'unionselect a.* from a left join c on a.id = c.id where c.col_c = 'true' set nocount on的疑问 两个表之间导数据sql语句写法的问题,就这么点分了 经常更新的字段是否需要单独放个表? 求高手将SQL语句封装到存储过程中 小弟请教 排考问题 sql语句难题啊!~大家帮忙啊!~急 请教!一个数据更新或插入的方法 关于Convert函数的问题 程序就提示程序已连接断开!如何解决?? 怎么在数据库里面存取视频的路径,还有如何在网页上提取此路径并且播放该视频 这个sql应该怎么写 数据表的命名
left join B on a.id=b.id
left join c on a.id=c.id
where b.col_b='true' or c.col_c='true'
select a.*
from a left join b on a.id = b.id
left join c on a.id = c.id
where b.col_b = 'true' or c.col_c = 'true'
select a.* from a left join b on a.id = b.id where b.col_b = 'true'
union
select a.* from a left join c on a.id = c.id where c.col_c = 'true'