distinct 去掉,特别是in后面

解决方案 »

  1.   

    去掉了,還慢,比去掉所有的distinct 還慢,如果去掉所有的distinct 會有重復
      

  2.   

    寫成以下那樣還是慢,不過好一點, 請大家繼續幫忙,謝謝!!!SELECT yy.employeecode, yy.employeename, yy.department, yy.attenddate, xx.dailyshift, yy.attendtime, yy.station
    FROM [select distinct  c.employeeid, d.dailyshift from processeddata as c,dailyshift as d  where c.dailyshiftid=d.id and d.dailyshift='注日A' and format(c.attenddate,'yyyy-mm-dd')>='2003-11-01' and format(c.attenddate,'yyyy-mm-dd')<='2003-11-17']. AS xx, [select b.id,a.employeecode,b.employeename,b.department, a.attenddate,a.attendtime,a.Station from attenddata as a ,employee as b where b.employeecode=a.employeecode and format(a.attenddate,'yyyy-mm-dd')>='2003-11-01' and format(a.attenddate,'yyyy-mm-dd')<='2003-11-17' and format(a.attendtime,'HH:mm')>='08:00' and format(a.attendtime,'HH:mm')<='18:00']. AS yy
    WHERE xx.employeeid=yy.id
    ORDER BY yy.employeecode, yy.attenddate, yy.attendtime;
      

  3.   

    能不能把你的数据库教本发给我,帮你试试。
    我的邮件地址:[email protected]
    另外请注明查询中表的数据量的大小。
      

  4.   

    AresChen(AresChen) 不行了  access db 700m
      

  5.   

    呵呵,老兄啊,谁也没让你把整个的数据库发过来啊,Access数据库是吗?我不知道能不能直接生成数据库脚本,你可以先把它到导入到SQL Server中,在利用SQL Server来生成数据库脚本。实际上,就是需要你的库结构,具体的数据要了也没用啊。