I have the following T-SQL query to delete a record from a series of tables:
DELETE FROM config INNER JOIN config_profile ON config.config_id = config_profile.config_id
INNER JOIN config_page ON config_profile.config_profile_id = config_page.config_profile_id
INNER JOIN config_field ON config_page.config_page_id = config_field.config_page_id
INNER JOIN config_constraint ON config_field.config_field_id = config_constraint.config_field_id
INNER JOIN config_constraint_type ON config_constraint.config_constraint_type_id = config_constraint_type.config_constraint_type_id
WHERE config.config_name = 'ConfigName' AND config_profile.profile_name = 'ProfileName'
But it keeps throwing the error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'INNER'.
Looking at it, I’m not sure what I’m missing. Any help is appreciated.
You need two FROMs I know its wierd
If you look at the online help here’s the syntax
The first from is
The second From is
As Tony points out you can optionally Drop the first FROM so its a bit more readable