sqlserver 怎么写

解决方案 »

  1.   

    mysql 可以这么写 , sqlserver 怎么写?
      

  2.   

    如果只有一张表,直接select * from a where id=1 and name=1如果是两张表:
    select a.* from a inner join b on a.id=b.id and a.name=b.name
      

  3.   

     select * from AA   where  AA.s in (...)  and AA.b in (...)
      

  4.   

    不知道你最终想要实现什么结果,看你的逻辑,觉得没意义。
    select * from a as A
    where exists (select 1 from a where A.id=id and A.name=name)
      

  5.   

    看楼主的意思,是要报 soruce  最大的那些记录。可以使用 row_number(有相同 source 的话,可以用 rank) 函数。 
      

  6.   

     A.id=id and A.name=name)  是 一个集合的组合  不止 一个单值
      

  7.   


    select * from a t1
    where exists (select 1 from a t2 where t2.id=t1.id and t2..name=t1.name)
      

  8.   

    没明白你的需求,SELECT * FROM a WHERE id = 1 AND name = '1'
      

  9.   


    --通过子查询,取到group 的数据,再关联原表。
    select * 
    From t_gm_scoreTotalAnalysis a
    join (select classType,subjectId,MAX(averageScore)averageScore
    from  t_gm_scoreTotalAnalysis 
    where kslc='1'
    group by classType,subjectId) b 
    on a.classType=b.classType and a.subjectId=b.subjectId and a.averageScore=b.averageScore
    where kslc='1'
      

  10.   

    MSSQL的in和not in只能用于一个列。多个列判断的话,要用exists或者not exists
      

  11.   

    用exists代替
      

  12.   

    select * 
    from 表a
     where
     id=1 and name=1
    select * 
    from表 a inner 
    join b on a.id=b.id and a.name=b.name