SELECT distinct job_code,max(job_date) from es_sampl_job  
不知道你要的逻辑,sigh

解决方案 »

  1.   

    樓上的方法不行,會出錯.
    Server: Msg 8118, Level 16, State 1, Line 1
    Column 'es_sampl_job.Job_Code' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause.
      

  2.   

    distinct是指相同的记录只取一条。
    你的记录是没有相同的呀。没有错误!
    job_code不可能为唯一的,除非你不要job_date字段,或者改用group语句:
    SELECT max(job_date) from es_sampl_job group by job_code 
      

  3.   

    SELECT job_code,job_date from es_sampl_job where job_code in (select distinct job_code from es_sampl_job )
    大概就是这样
      

  4.   

    SELECT distinct job_code,max(job_date) from es_sampl_job
    Group By job_code---------------------------------------------------------
    Montaque==Digitalboy==Houyongfeng==Monkey
      

  5.   

    试试 SELECT DISTINCT JOB_CODE,CONVERT(CHAR(10),JOB_DATE,120)
    FROM ES_SAMP1_JOB