dba123
asked on
Delete question - opposite of insert statement
How would I do the opposite of my insert below with a delete statement. I want to
Insert INTO LData
([number], ctl, code, l1)
SELECT m.[number], NULL, '88', 'sometext'
from phone p (NOLOCK)
inner join master m on m.number = p.number
where (p.1 is null) or (p.2 = 1)
Insert INTO LData
([number], ctl, code, l1)
SELECT m.[number], NULL, '88', 'sometext'
from phone p (NOLOCK)
inner join master m on m.number = p.number
where (p.1 is null) or (p.2 = 1)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Delete FROM ldata
INNER JOIN phon p on p.[number] = m.[number]
INNER JOIN master m on m.number = ldata.number
where (p.1 is null) or (p.2 = 1)
and ldata..code = '88'
I am getting an error: Incorrect syntax near the keyword 'INNER'.
not sure why
INNER JOIN phon p on p.[number] = m.[number]
INNER JOIN master m on m.number = ldata.number
where (p.1 is null) or (p.2 = 1)
and ldata..code = '88'
I am getting an error: Incorrect syntax near the keyword 'INNER'.
not sure why
The order in incorrect and from clause is missing
Delete ldata FROM ldata (ldata is written twice if u see)
and
INNER JOIN phon p on p.[number] = m.[number] should be after the second inner clause as m is not yet available
Use the version I posted.
Delete ldata FROM ldata (ldata is written twice if u see)
and
INNER JOIN phon p on p.[number] = m.[number] should be after the second inner clause as m is not yet available
Use the version I posted.
and
ldata..code
should be ldata.code (just one .)
ldata..code
should be ldata.code (just one .)
ASKER
whoops, I didn't see that..hold on
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER