由买买提看人间百态

topics

全部话题 - 话题: taskname
(共0页)
M*********e
发帖数: 190
1
来自主题: Database版 - 怎么写这个total的query
task table is the original table.
SELECT v1.*,
v2.total
FROM task v1
LEFT OUTER JOIN
(SELECT t1.*,
t2.total
FROM task t1,
(SELECT taskname,
taskstatus,
COUNT(*) AS total
FROM task
GROUP BY taskname,
taskstatus
) t2
WHERE t1.taskname=t2.taskname
AND t1.taskstatus=t2.taskstatus
AND t1.taskid IN
(SELECT MAX(taskid) FROM task GROUP BY taskname, taskstatus
)
) v2
ON v1.taskid=v2.taskid
ORDER BY v1.taskid;
S**H
发帖数: 1256
2
来自主题: Database版 - 怎么写这个total的query
用的是third party application. 所以一些standard SQL 支持的都不能用.
roll up 是没有的.怎么用一些basic sql 写.谢谢大家了.
TaskName TaskStatus TaskID
A open 1
A open 2
A Done 4
B pending 7
B done 99
expected results:
TaskName TaskStatus TaskID Total
A open 1
A open 2 2
A Done 4 1
B pending 7
B done 99 1
B pending 100 ... 阅读全帖
A*******s
发帖数: 3942
3
郁闷了,有个错误咋都不明白怎么回事。
systask command '"C:\Program Files\SAS\SASFoundation\9.2\sas.exe"
-sysin "C:\threadtest.sas"
-sysparm "for test" -log "C:\logtest.txt"'
taskname=test1 status=teststatus1;
老是提示我Error: invalid file C:\threadtest.sas
为啥invalid呢,想不明白
(共0页)