【发布时间】:2014-07-25 16:47:32
【问题描述】:
我有一种情况,我需要计算作业表中每个作业号的记录(行)数。我有以下执行此操作的选择脚本。
Select job, COUNT (*) AS 'Lines'
FROM jobtable
GROUP BY job
Job Lines
--------- --------
1 26
2 12
3 46
...
现在我想使用名为“时间”的列中的计数结果来更新第二个表“材料”。所以在名为materials的表中job = 1 update time = 26,其中job is = 2 update the time = 12 etc......
【问题讨论】:
-
这可能会有所帮助,非常相似 - stackoverflow.com/questions/12225715/…。
标签: sql-server