Friday, March 23, 2012

noob syntax question

What am I doing wrong?:
DELETE FROM tblmainacs2 WHERE tblmainacs2.IDnum = Meter.id

I get this message:
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Meter.id" could not be bound.

Is Meter a table? If so you do contain an explicit reference to it in the DELETE statement in the FROM clause or part of subquery for example. You can write it like below assuming you want to perform a join:

delete from tblmainacs2

where IDnum in (select id from Meter)

|||Thank you. That query did exaclty what I wanted. Could someone show me some different queries that do exactly the same thing, just for learning purposes. Thanks in advancesql

No comments:

Post a Comment