Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is wrong with delete/join syntax? 1

Status
Not open for further replies.

pandatime

Programmer
Joined
Jan 29, 2010
Messages
92
Location
AU
Hi,

Not sure why it doesn't like this:

Code:
delete from map a
join
	(
	select pk from map m
	join dup d on (m.id = d.id)
	where isnumeric(m.text) = 0
	) b
on (a.pk = b.pk)

Msg 102, Level 15, State 1, Line 8
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 14
Incorrect syntax near 'b'.
 
Try this;

Code:
delete from map
  from map a
  join dup d on (a.id = d.id)
  where isnumeric(a.text) = 0
 
When you have multiple tables involved in a delete, you need to identify which table to delete from.

Try this:

Code:
delete [!]a[/!] from map a
join
    (
    select pk from map m
    join dup d on (m.id = d.id)
    where isnumeric(m.text) = 0
    ) b
on (a.pk = b.pk)

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top