如何统计发货信息表中的客户数量(即要剔除同一客户的重复发货)表中数据为每次的发货信息,肯定有同一客户不同时间的发货,如何正确的统计到一共有多少客户(客户名称)呢
要限定一个时间段 (发货日期)谢谢

解决方案 »

  1.   

    select distinct 客户 from 表 where 发货日期='2006-10-10'select distinct 客户 from 表 where 发货日期 between '2006-10-10' and '2006-12-12'
      

  2.   

    如果是sqlserver:
    select distinct 客户 from 表 where 发货日期 between '2006-1-7 00:00:00' and '2006-2-12 23:59:59'
    如果是access就:
    select distinct 客户 from 表名 where 发货日期 between #" & date1 & " # and # " & date2 &" #"
    注意一下:如果你的 [发货日期]是带有时间的话就用第一种的格式