Gossamer Forum
Home : Products : Gossamer Links : Discussions :

help needed: delete data from one table based on joined select

Quote Reply
help needed: delete data from one table based on joined select
Hi,

I would like to transfer a delete statement to GT::SQL but could not find the right way.
If tables are related I do not succeed to delete data from just one table while I select based on information from another.
So I had to work around with pure SQL commands. I would appreciate it very much if somebody could help me out here.
The first is the select and based on this I created a delete which works as I like it.

Code:
SELECT
glinks_TABLE1.* from glinks_TABLE1
LEFT JOIN glinks_TABLE2 ON glinks_TABLE1.ID=glinks_TABLE2.ID
WHERE glinks_TABLE2.SUPPLIER_ID LIKE 11486

DELETE
glinks_TABLE1.* from glinks_TABLE1
LEFT JOIN glinks_TABLE2 ON glinks_TABLE1.ID=glinks_TABLE2.ID
WHERE glinks_TABLE2.SUPPLIER_ID LIKE 11486

Regards

Niko

Last edited by:

el noe: Dec 24, 2008, 2:08 AM