select * from P_Tree where parentid=@parentid
and (endstation = 真 and "在power中")

解决方案 »

  1.   

    对不起补充一下,power中的formname应为nodename
      

  2.   

    select * from P_Tree where parentid=@parentid
    or (endstation = 1 and "在power中")
      

  3.   

    select * from P_Tree where parentid=@parentid
    and (endstation=0 or (endstation=1 and exists(select 1 from power where formname=p_tree.nodename)))
      

  4.   

    To:txlicenhe(马可)
       需要判断endstation,如果为真的时候才去比较nodename是否存在于power中的formname中,如果为假则不需要去判断