Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Issue - help
Message
From
18/08/2000 18:06:42
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00406920
Message ID:
00406923
Views:
13
Don't nest the JOIN..ON clauses, just go straight down how you'd like them to join. See if that helps. e.g., (note that I put the Answers table joins next to each other)
lcFirmKey = "00000000"
SELECT Questions.qkey, Answers.akey, Answers.adate, Answers.answer,;
	Answers.seealso, Questions.firmkey, Questions.catkey, Questions.qdate,;
	Questions.question, Kbcats.catname, Kbusers.username AS Q_By_Name, ;
	Kbusers.userkey AS Q_By_Key, KBAnsU.UserName AS A_By, ;
	KBAnsU.userkey AS A_By_Key;
	FROM  .\kbdata\knowledge!answers ;
	RIGHT OUTER JOIN .\kbdata\knowledge!questions ;
	ON  Answers.qkey = Questions.qkey ;
	LEFT OUTER JOIN .\kbdata\knowledge!kbusers kbAnsU ;
	ON Answers.UserKey = KBAnsU.UserKey ;
	INNER JOIN .\kbdata\knowledge!kbcats;
	ON  Questions.catkey = Kbcats.catkey ;
	INNER JOIN .\kbdata\knowledge!kbfirms;
	ON  Questions.firmkey = Kbfirms.firmkey ;
	LEFT OUTER JOIN .\kbdata\knowledge!kbusers;
	ON  Questions.userkey = kbusers.userkey ;
	WHERE Questions.firmkey = lcFirmKey ;
	ORDER BY CatName, Questions.qkey, QDate ;
	INTO CURSOR TQuery
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform