Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
killtacularmania
Starting Member
22 Posts |
Posted - 2009-12-07 : 09:17:11
|
| Hey guys I need to learn how to do any update with a group by statement please see my code below. Thanks for any help.Update EmployeesSet Late = '1'FROM Exclusions INNER JOIN Employees ON Exclusions.EmpNumber = Employess.EmpNumberWHERE (Exclusions.ExclDesc = N'Late')GROUP BY Exclusions.EmpNumberHAVING (COUNT(*) > 1) |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-12-08 : 01:36:03
|
| Hi try thisUPDATE EmpSET Emp.Late = 1FROM Employees EmpINNER JOIN ( SELECT Ex.EmpNumber FROM Exclusions Ex INNER JOIN Employees E ON E.EmpNumber = Ex.EmpNumber WHERE Ex.ExclDesc = N'Late' GROUP BY Ex.EmpNumber HAVING COUNT(Ex.EmpNumber) > 1 )) T ON T.EmpNumber = Emp.EmpNumber |
 |
|
|
|
|
|