I am trying to do an Update query with a left join in SQL Server 2005 but for some reason it's not working.

My SQL statement is this:

UPDATE [tblSlots]
SET [tblSlots].[PublishedStartTime] = '10:00'
FROM tblSlots
LEFT JOIN tblDays ON tblSlots.SlotDayID = tblDays.DayID
WHERE tblDays.Published = 1

If I take out the LEFT JOIN line and just filter on e.g. a tblSlots.SlotID, the update works fine.

But I'd like to be able to update the slots on ALL published days at once.

(I tried it as just a JOIN, but that didn't work either...)

I'm sure it's something terribly obvious...

Thanks for your help!


1 Answers

omarhabeh On

try 'having' instead of 'where'