SQL Server 2008: TOP 10 and distinct together

后端 未结 13 1590
刺人心
刺人心 2021-02-04 23:41

As the title says, I\'m using SQL Server 2008. Apologies if this question is very basic. I\'ve only been using SQL for a few days. Right now I have the following query:

13条回答
  •  不知归路
    2021-02-05 00:11

    SELECT DISTINCT * FROM (
    
    SELECT TOP 10 p.id, pl.nm, pl.val, pl.txt_val
    
    from dm.labs pl
    join mas_data.patients p    
      on pl.id = p.id
      where pl.nm like '%LDL%'
      and val is not null
    
    )
    

提交回复
热议问题