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 |
|
soori457
Yak Posting Veteran
85 Posts |
Posted - 2008-12-27 : 05:38:48
|
| Hai Every One, am getting error while executing the below query.update Attendance set Mispunch = 'M'where CardNo and Dt in(select CardNo, Dt from #Attendance where (OutCnt = 0 or InCnt = 0))Thanks in AdvanceSuresh Kumar |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2008-12-27 : 07:50:38
|
| u should not write subquery like that try this onceupdate Attendance set Mispunch = 'M'where CardNo in(select CardNo from #Attendance where (OutCnt = 0 or InCnt = 0)) and dt in (select dt from #Attendance where (OutCnt = 0 or InCnt = 0)) |
 |
|
|
soori457
Yak Posting Veteran
85 Posts |
Posted - 2008-12-27 : 08:50:00
|
| Thnks for ur reply.Bt its not working.I want both CardNo and Dt should be checked at same timeSuresh Kumar |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2008-12-27 : 09:16:40
|
| You could join Attendance and #Attendance, something like this:update Attendance set Mispunch = 'M'from Attendance a inner join #Attendance bon a.CardNo = b.CardNo and a.Dt=b.Dt and (b.OutCnt=0 or b.InCnt=0) |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2008-12-27 : 11:08:30
|
| Use EXISTS....where EXISTS(select 1 from #Attendance t where (OutCnt = 0 or InCnt = 0) AND t.CardNo = Attendance.CardNo AND t.Dt = Attendance.dt)--Gail ShawSQL Server MVP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|