PDA

View Full Version : You have an error in your SQL syntax


nikos101
04-24-2008, 05:48 PM
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 'LEFT JOIN StimulusSelections ON Stimulus.StimulusID = StimulusSelect' at line 1
DELETE from Articles, Setup, Subjects, Trials, Tasks, Stimulus LEFT JOIN StimulusSelections ON Stimulus.StimulusID = StimulusSelections.StimulusID WHERE AricleID = 32


help :)

Fumigator
04-24-2008, 05:59 PM
Looks like you're missing the keyword "USING".


DELETE FROM t1, t2 USING t1 INNER JOIN t2 INNER JOIN t3
WHERE t1.id=t2.id AND t2.id=t3.id;


(Example from the manual)

http://dev.mysql.com/doc/refman/5.0/en/delete.html

nikos101
04-24-2008, 06:30 PM
Sorry I don't get it could you spell it our using my query?

Fumigator
04-24-2008, 06:45 PM
If deleting from multiple tables with one query is beyond your depth, I suggest deleting from one table at a time.

nikos101
04-24-2008, 07:13 PM
THanks ;)

Using other table names I got

Unknown table 'tblArticles' in MULTI DELETE

DELETE from tblArticles, tblArtSetup, tblArtSubjects, tblArtTrials, tblArtTasks, tblArtStimulus,tblStimulusSelections USING tblArtStimulus LEFT JOIN tblStimulusSelections on tblArtStimulus.StimulusID = tblStimulusSelections.StimulusID WHERE ArticleID = 32I'm sure tblArticles exists