解决方案 »

  1.   

    use tempdb
    if object_id('tb') is not null drop table tb
    go
    create table tb([id] INT,[val] INT)
    insert into tb
    select 1,1 union all
    select 2,1 union all
    select 3,2 
    go
    select top 1 with ties * from tb order by val
    /*
    id          val
    ----------- -----------
    1           1
    2           1*/
    ;with cte as
    (
    select * from tb where val = 1
    )
    select * from cte
    /*
    id          val
    ----------- -----------
    1           1
    2           1
    */
      

  2.   

    SELECT 
        REPLACE(REPLACE(REPLACE('1楼的朋友 我是你这样的回复就不回贴了。','1','3'),'回帖','发帖'),'回复','发帖');
      

  3.   

    是哪个with??
    是CTE还是什么??
      

  4.   

    with等于就是把查询结果集,放到一个变量上,对吧
      

  5.   


    lz 你这个问题蛮大的哦。 with有很多用法。
    不信你真的搜一下联机帮助看看。有很多带with的条目的...
    具体到你要的细节,没有更多的条件,无从说起的哦!