select a.* from tk_xztda a left join tk_xzt b on a.tid=b.id
where b.tx=1 and a.tid not in(select c.tid from tk_xztda c left join tk_xzt d on tid=d.id where tx=1 and is_true=1 group by tid) 
order by tid我用上面这个语句已经检索出tk_xztda表里要的内容,但是我想输出以上检索出来的内容应该怎么写?delete from(
select a.* from tk_xztda a left join tk_xzt b on a.tid=b.id
where b.tx=1 and a.tid not in(select c.tid from tk_xztda c left join tk_xzt d on tid=d.id where tx=1 and is_true=1 group by tid) 
order by tid)为什么不行啊?请帮忙!

解决方案 »

  1.   

    试试
    delete from( 
    select a.* from tk_xztda a left join tk_xzt b on a.tid=b.id 
    where b.tx=1 and a.tid not in(select c.tid from tk_xztda c left join tk_xzt d on tid=d.id where tx=1 and is_true=1 group by tid) 
    order by tid) t
      

  2.   

    服务器: 消息 170,级别 15,状态 1,行 1
    第 1 行: '(' 附近有语法错误。
    服务器: 消息 156,级别 15,状态 1,行 4
    在关键字 'order' 附近有语法错误。
      

  3.   


    delete tk_xztda
    from tk_xzt b
    where tk_xztda.tid=b.id and b.tx=1
    and tk_xztda.tid not in (select c.tid from tk_xztda c left join tk_xzt d on c.tid=d.id where d.tx=1 and is_true=1 group by tid)
      

  4.   

    delete from( 
    select a.* from tk_xztda a left join tk_xzt b on a.tid=b.id 
    where b.tx=1 and a.tid not in(select c.tid from tk_xztda c left join tk_xzt d on tid=d.id where tx=1 and is_true=1 group by tid) 
    order by tid) delete一个别外当然不行。
      

  5.   

    直接delete a.* from tk_xztda a left join tk_xzt b on a.tid=b.id 
    where b.tx=1 and a.tid not in(select c.tid from tk_xztda c left join tk_xzt d on tid=d.id where tx=1 and is_true=1 group by tid) 
    order by tid 
    就行