Link to home
Start Free TrialLog in
Avatar of dba123
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)
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dba123
dba123

ASKER

cool, I was close then, thank you
Avatar of dba123

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
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.
and

ldata..code

should be ldata.code (just one .)
Avatar of dba123

ASKER

whoops, I didn't see that..hold on
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial