![alt text] [1]
[1]:http://C:\ Documents and Settings \ Administrator \ My Documents \ My Pictures \ Ashampoo Magical Snap 2 \ Magical Snap - 2009.11.16 23.07 - 003.jpg
在参考图片时,有几个条目重复相同的学生ID。如果发生这种情况,我想将在一个学生证下共计任何多个条目所欠的钱合并。我需要在下面的代码中添加什么才能完成此操作? 我正在使用Access 2007&下面的代码是负责生成图片表的SQL视图。 Thnaks,提前帮忙!!!
SELECT Students.[Student ID], Students.[Last Name], Students.[Dorm Addess], [Number of Hours]*[Price Per Hour] AS [Money Owed]
FROM Students INNER JOIN ([Price List and Job Description] INNER JOIN Visits ON [Price List and Job Description].[Job ID] = Visits.[Job ID]) ON Students.[Student ID] = Visits.[Student ID];
答案 0 :(得分:2)
好吧,如果我理解你需要一个SUM和GROUP BY来实现这个目标。
像这样的东西
SELECT Students.[Student ID],
Students.[Last Name],
Students.[Dorm Addess],
SUM([Number of Hours]*[Price Per Hour]) AS [Money Owed]
FROM Students INNER JOIN
([Price List and Job Description] INNER JOIN
Visits ON [Price List and Job Description].[Job ID] = Visits.[Job ID]) ON Students.[Student ID] = Visits.[Student ID]
GROUP BY Students.[Student ID],
Students.[Last Name],
Students.[Dorm Addess]
答案 1 :(得分:1)
intarwebs无法访问您的C:\ Documents and Settings \,没有人看到您的jpeg