如select * from A where t1 ="xxx" and t0="ccc";select * from A where t2 ="yyx" and t3="ccc" and t0="ccc";怎么用一条语句写上面的两个查询t1和t2,t3是or的关系,t2,t3是and的关系

解决方案 »

  1.   

    t1和t2,t3是or的关系,t2,t3是and的关系
    你这里本身说的就矛盾啊
    t1 t2 t3都是or的关系  怎么后面t2和t3又是and的关系呢
      

  2.   

    t1和t2,t3是or的关系,t2,t3是and的关系
    你这里本身说的就矛盾啊
    t1 t2 t3都是or的关系  怎么后面t2和t3又是and的关系呢
      

  3.   

    一、
    select * from A where t2 ="yyx" and t3="ccc" and t0="ccc" or t1 ="xxx" and t0="ccc"; 
    二、
    select * from (select  * from A where t0="ccc") where t2 ="yyx" and t3="ccc" or t1 ="xxx"; 
      

  4.   

    综合分析了楼主的意图,应该是这样来实现的
    or用union来表示,and 用where里的条件来表示
    select * from A where t2 = "yyx" and t3= "ccc"
    union
    select * from A where t1 = "XXX"
      

  5.   

    t1='xxx' or (t2='xxx' and t3='xxx')