如何用一条语句实现下面的三条的效果
select * from [] where id = 1;
select * from [] where id = 3;
select * from [] where id = 1;  用
select * from [] where id in(1,3,1)
结果只是1 3  而没有三条~

解决方案 »

  1.   

    select * from [] where id = 1;
    union all
    select * from [] where id = 3;
    union all
    select * from [] where id = 1;
      

  2.   

    select * from [] where id in(1,3)
      

  3.   

    select * from [] where id in(1,3) 
    union all select * from [] where id =1
      

  4.   

    如何用一条语句实现下面的三条的效果
    select * from [] where id = 1;
    select * from [] where id = 3;
    select * from [] where id = 1;  用
    select * from [] where id in(1,3,1)
    结果只是1 3  而没有三条~
    第三条和第一条语句不是一样的吗?select * from [] where id = 1;  哪结果怎么不一样?要这么多重复的记录做什么?
      

  5.   

    回 wgzaaa() 
    ---------------------
    这个重复的数据是不固定的,也可能不重复,也可能重复好几次,位置也无法确定。所以你的方法实现起来也不太好办~
     
      

  6.   

    回 :fffddd(假钞换贞操)
    -------------------
    等你用到时就明白为什么非要这样了。