Click here to Skip to main content
16,008,183 members
Home / Discussions / Database
   

Database

 
GeneralHelp with SQL query Pin
brdavid26-Jun-04 9:52
brdavid26-Jun-04 9:52 
GeneralRe: Help with SQL query Pin
Michael Potter28-Jun-04 7:07
Michael Potter28-Jun-04 7:07 
GeneralRe: Help with SQL query Pin
brdavid28-Jun-04 9:11
brdavid28-Jun-04 9:11 
GeneralRe: Help with SQL query Pin
Michael Potter28-Jun-04 10:37
Michael Potter28-Jun-04 10:37 
GeneralRe: Help with SQL query Pin
brdavid28-Jun-04 12:04
brdavid28-Jun-04 12:04 
GeneralRe: Help with SQL query Pin
Michael Potter29-Jun-04 8:55
Michael Potter29-Jun-04 8:55 
GeneralRe: Help with SQL query Pin
brdavid30-Jun-04 2:37
brdavid30-Jun-04 2:37 
GeneralRe: Help with SQL query Pin
Grimolfr28-Jun-04 9:58
Grimolfr28-Jun-04 9:58 
I think your problem is all the extra unnecessary parens you have. If you'll notice, each of your original joins only joins with a table one level deeper than the join. (For instance, ss is only joined to s, not to c or cg.)

But when you added the new join, you tried to join all the way back to the deepest level. (i.e. you're trying to join all the way back to cg.)

It's easier to visualize here:
SELECT
		...
FROM
		(
			(
				(
					CATEGORYGROUPS AS cg
					LEFT JOIN CATEGORY AS c
						ON cg.GroupCode = c.GroupCode
				)
				LEFT JOIN SKILLS AS s
					ON (c.CategoryCode = s.CategoryCode)
					AND (c.GroupCode = s.GroupCode)
			)
			LEFT JOIN SUBSKILLS AS ss
				ON (s.GroupCode = ss.GroupCode)
				AND (s.CategoryCode = ss.CategoryCode)
				AND (s.SkillCode = ss.SkillCode)
		)
		LEFT JOIN SKILLSINAGES sia
			ON (cg.GroupCode = sia.GroupCode)
			AND (c.CategoryCode = sia.CategoryCode)
			AND (s.SkillCode = sia.SkillCode)
			AND (ss.SubSkillCode = sia.SubSkillCode)
WHERE
		...


I'm not sure about Access, because I haven't used it for years, but if it were on a SQL Server, I'd remove the parens, like this:
SELECT
		...
FROM
		CATEGORYGROUPS AS cg
		LEFT JOIN CATEGORY AS c
			ON cg.GroupCode = c.GroupCode
		LEFT JOIN SKILLS AS s
			ON (c.CategoryCode = s.CategoryCode)
			AND (c.GroupCode = s.GroupCode)
		LEFT JOIN SUBSKILLS AS ss
			ON (s.GroupCode = ss.GroupCode)
			AND (s.CategoryCode = ss.CategoryCode)
			AND (s.SkillCode = ss.SkillCode)
		LEFT JOIN SKILLSINAGES sia
			ON (cg.GroupCode = sia.GroupCode)
			AND (c.CategoryCode = sia.CategoryCode)
			AND (s.SkillCode = sia.SkillCode)
			AND (ss.SubSkillCode = sia.SubSkillCode)
WHERE
		...


I think the deep nesting is confusing the parser.


Grim
(aka Toby)
MCDBA, MCSD, MCP+SB


SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)

GeneralInserting Rows... Pin
Sai197125-Jun-04 19:59
Sai197125-Jun-04 19:59 
GeneralRe: Inserting Rows... Pin
Rein Hillmann26-Jun-04 22:11
Rein Hillmann26-Jun-04 22:11 
QuestionHow Can I Join more than two tables in SQL Pin
JawedVikia8024-Jun-04 21:40
JawedVikia8024-Jun-04 21:40 
AnswerRe: How Can I Join more than two tables in SQL Pin
Colin Angus Mackay24-Jun-04 22:03
Colin Angus Mackay24-Jun-04 22:03 
AnswerRe: How Can I Join more than two tables in SQL Pin
wgdesigner25-Jun-04 1:38
wgdesigner25-Jun-04 1:38 
GeneralConcurrency Pin
IamADotNetGuy24-Jun-04 10:04
IamADotNetGuy24-Jun-04 10:04 
GeneralRe: Concurrency Pin
Rein Hillmann26-Jun-04 22:13
Rein Hillmann26-Jun-04 22:13 
GeneralRe: Concurrency Pin
Grimolfr28-Jun-04 7:56
Grimolfr28-Jun-04 7:56 
GeneralRe: Concurrency Pin
IamADotNetGuy28-Jun-04 8:07
IamADotNetGuy28-Jun-04 8:07 
GeneralSQL Query Pin
Guinness4Strength24-Jun-04 9:39
Guinness4Strength24-Jun-04 9:39 
GeneralRe: SQL Query Pin
Michael Potter25-Jun-04 3:32
Michael Potter25-Jun-04 3:32 
Generalproblem: records appear twice in dataset Pin
sharonz24-Jun-04 6:30
sharonz24-Jun-04 6:30 
GeneralRe: problem: records appear twice in dataset Pin
IamADotNetGuy28-Jun-04 10:43
IamADotNetGuy28-Jun-04 10:43 
GeneralVery easy question Pin
Guinness4Strength24-Jun-04 5:57
Guinness4Strength24-Jun-04 5:57 
GeneralRe: Very easy question Pin
Colin Angus Mackay24-Jun-04 6:14
Colin Angus Mackay24-Jun-04 6:14 
GeneralRe: Very easy question Pin
Guinness4Strength24-Jun-04 6:29
Guinness4Strength24-Jun-04 6:29 
GeneralRe: Very easy question Pin
Steven Campbell24-Jun-04 7:23
Steven Campbell24-Jun-04 7:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.