select mytable.*,b.* from mytable join (select yourtable.* ,c.* from yourtable join (select * from othertable where del=1)c on yourtable .del=c.del)b on mytable.del=b.del
三个表的结果是一样的吗?如果是: select mytable.* where del=1 union all select yourtable.* where del=1 union all select othertable.* where del=1 如果不一样: select mytable.* where del=1 select yourtable.* where del=1 select othertable.* where del=1
应该是: 三个表的结构是一样的吗?如果是:select mytable.* from mytable where del=1 union all select yourtable.* from yourtable where del=1 union all select othertable.* from othertable where del=1 如果不一样: select mytable.* from mytable where del=1 select yourtable.* from yourtable where del=1 select othertable.* from othertable where del=1 老出错哦!
(select yourtable.* ,c.* from yourtable join
(select * from othertable where del=1)c
on yourtable .del=c.del)b
on mytable.del=b.del
三个表没有关系,只有del字段是一样的,不是1就是0
select mytable.* where del=1
union all
select yourtable.* where del=1
union all
select othertable.* where del=1
如果不一样:
select mytable.* where del=1
select yourtable.* where del=1
select othertable.* where del=1
三个表的结构是一样的吗?如果是:select mytable.* from mytable where del=1
union all
select yourtable.* from yourtable where del=1
union all
select othertable.* from othertable where del=1
如果不一样:
select mytable.* from mytable where del=1
select yourtable.* from yourtable where del=1
select othertable.* from othertable where del=1
老出错哦!