问一条sql语句:A,B,C三张表,如果表A的当前记录满足一个条件的话就和B作连接,如果不满足就和C作连接。怎么写? select a.*,(case when a.col='满足一个条件' then (select col from b where b.id=a.id) else (select col from c where c.id=a.id) End) form a 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from A left join B on A.id=B.id and a.col1=1left join C on a.id=c.id and a.col1<>1 不好意思,我是说做outer join的连接。 if exists (select 1 from A 条件)select * from A,B wher 条件elseselect * from A,C where 条件 求一索引建立方案 从SQL中读取缩略图在datagridview上 视图查询速度 3个表合并的问题 求sql数组显示统计语句! 更新某列的值 一个小数点位数问题 ◆◆在线狂等ing 一个巨简单的sql语句◇◇ 数据库同步问题,此服务器已经断开。必须重新连接以执行此操作。 关于数据库设计和备份的一个大问题 如何把执行一条Sql串变量,把结果插如临时表. 存储过程内两表之间传参数问题
left join C on a.id=c.id and a.col1<>1
select * from A,B wher 条件
else
select * from A,C where 条件