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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use INNER JOIN on DELETE? 1

Status
Not open for further replies.

3dColor

Programmer
Jan 10, 2006
240
US
I can't seem to delete where using a Inner Join.

Code:
DELETE 
FROM 	Stats INNER JOIN ListingParameter ON Stats.listingFk = ListingParameter.listingFk
WHERE 	Stats.listingFk = <cfqueryparam value='#FORM.ad#' cfsqltype='cf_sql_integer'>
AND ListingParameter.status = '0'

I get the following error:

Syntax error or access violation: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN ListingParameter ON Stats.listingFk = ListingParameter.listingFk ' at line 2

Do I have bad syntax?
 
Code:
delete from stats, listingparamater
where
Stats.listingFk = ListingParameter.listingFk
and
Stats.listingFk = <cfqueryparam value='#FORM.ad#' cfsqltype='cf_sql_integer'>
AND ListingParameter.status = '0'

also you need version 4.1 IIRC to do a delete where you name more than one table. It might be 4.0 though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top