您的位置:程序门 -> ms-sql server -> 疑难问题



``请教一个sql的写法``很急```


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


``请教一个sql的写法``很急```[已结贴,结贴人:myingbei]
发表于:2007-07-31 14:51:53 楼主
```````我用的是一个人员信息表``
            现在存在这个sql```````
select   count(distinct   r.emp_id)   from   report_address   as   r,employee   as   e   where   e.emp_id=r.emp_id     group   by   sign_date
              我想对所求列进行磊加``
    应该怎么写语句啊``
发表于:2007-07-31 14:54:201楼 得分:40
這個意思?

select   sum(countemp_id)   from   (select   count(distinct   r.emp_id)   as   countemp_id     from   report_address   as   r,employee   as   e   where   e.emp_id=r.emp_id     group   by   sign_date)   a
发表于:2007-07-31 14:54:552楼 得分:0
好象可以這樣

select   count(distinct   r.emp_id)   as   countemp_id     from   report_address   as   r,employee   as   e   where   e.emp_id=r.emp_id
发表于:2007-07-31 14:56:273楼 得分:0
那个a是什么意识啊``
发表于:2007-07-31 16:04:554楼 得分:0
a是子查詢的紀錄集的別名。


快速检索

最新资讯
热门点击