如何将此表与特定的按值分组。我需要按“完成日期”,“ ETR日期”,“设备名称”,“项目”和“操作员姓名”将其分组,但需要在同一行中显示“ ETR实际小时数”,“完成实际小时数”等。
这是我的示例查询。
SELECT * FROM
(
SELECT '' as AccomplishmentDate, ETRDate, ProjectName,EquipmentName, 0 as
AccomplishmentActualHour, ETRActualHour FROM Table1
UNION
SELECT AccomplishmentDate, '' as ETRDate, ProjectName,,EquipmentName,
AccomplishmentActualHour,0 as ETRActualHour FROM Table1
)as Transaction
答案 0 :(得分:0)
选择所需的名称或列。不要使用*。它选择所有属性 像Select Compcomplisment ..... from(select * from table union select * from table