Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 To JOIN or not to JOIN
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

snaayk
Senior Member

USA
1061 Posts

Posted - 06 March 2002 :  10:46:45  Show Profile  Visit snaayk's Homepage  Send snaayk an AOL message  Send snaayk an ICQ Message  Send snaayk a Yahoo! Message
When do you join and when don't you? I am a little confused because I came accross some code in the forum and differs from what I have seen elsewhere.

The following statements get the same results (I think so...):

SELECT TBL1.FIELD1, TBL1.FIELD2, TBL1.FIELD3, TBL2.FIELD1, TBL2.FIELD2
FROM TBL1, TBL2
WHERE TBL2.FIELD3 = TBL1.FIELD3

SELECT TBL1.FIELD1, TBL1.FIELD2, TBL1.FIELD3, TBL2.FIELD1, TBL2.FIELD2
FROM TBL2 INNER JOIN TBL1 ON TBL2.FIELD3 = TBL1.FIELD3

So, the question is, which do you use? Obviously, if you're using a variable off of the querystring, you don't have a choice. But if your data is from 2 tables which is best?

Nathan
Help Moderator

USA
7664 Posts

Posted - 06 March 2002 :  10:52:59  Show Profile  Visit Nathan's Homepage
The top version is usually used in the fourm. It might be because it makes more logical since and it might be that is it more corss-database complient.

Joins can get confusing. . . but that makes them all the more fun

  Nathan Bales - Romans 15:13
----------------------------------

Snitz Exchange | Do's and Dont's
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 06 March 2002 :  11:09:46  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
Those are actually both JOINS. One is just the ANSI standard and the other is not (don't remember which is which).

It's a matter of taste personally. I find the first one much easier to read.

Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 06 March 2002 :  11:14:05  Show Profile
Joins are confusing! And besides, the two statements are essentially equivalent. Doing a "WHERE blah = ugh" is an implied join.

Nikkol
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 06 March 2002 :  11:22:03  Show Profile  Visit Nathan's Homepage
Its still considered a join, just using different logic.

  Nathan Bales - Romans 15:13
----------------------------------

Snitz Exchange | Do's and Dont's
Go to Top of Page

snaayk
Senior Member

USA
1061 Posts

Posted - 06 March 2002 :  11:44:57  Show Profile  Visit snaayk's Homepage  Send snaayk an AOL message  Send snaayk an ICQ Message  Send snaayk a Yahoo! Message
aahhh, I see. Implying is sometimes better than just saying it [;]
I agree, the top one is more simple, a lot easier to read than the non-implied join.

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 06 March 2002 :  13:46:49  Show Profile  Send ruirib a Yahoo! Message
All the previous is true because you have a inner join. If it was an outer join, it would be a different scenario. You couldn't use a WHERE clause to do it...

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 06 March 2002 :  18:26:23  Show Profile  Visit Nathan's Homepage
Really? I just know how to make a join, not all the terminology and what the differences are. Please explain inner vs outer join, left vs right join. *learning oppertunity*

  Nathan Bales - Romans 15:13
----------------------------------

Snitz Exchange | Do's and Dont's
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 07 March 2002 :  00:31:46  Show Profile
This explanation may help

http://cesspool.crseo.ucsb.edu:8679/FAQ/Joins.html


======
Doug G
======
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 07 March 2002 :  05:30:38  Show Profile  Send ruirib a Yahoo! Message
There is a good explanation by HuwR here:

http://forum.snitz.com/forum/topic.asp?TOPIC_ID=23207

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000 Version 3.4.07