TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-04-2007, 10:25 PM   #1 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default JOINS, I suck at them.

Anyone know of any good tutorials for JOINS.
Nor is offline  
Reply With Quote
Old 11-05-2007, 12:40 AM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Tizag has a fairly good MySQL JOIN tutorial. Right over here!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 11-12-2007, 05:30 PM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I thought I'd just extend onto that and give you an example of a few joins. There are:
  • LEFT JOIN - Used to include data from the left table, but optional on the right table.
  • RIGHT JOIN - Same as above just other way round.
  • INNER JOIN - Used to include data that is present in both tables - so like an ID matching up to a foreign ID in the other table.
  • NATURAL JOIN - Used to match up a pair of items from the 2 tables that have the same field name. ID to ID, for instance.

There are others like OUTER JOIN which I'm sure others will elaborate on, but the top 4 are what I use most :)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 11-12-2007, 06:11 PM   #4 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default

Thanks for the reply.
Nor is offline  
Reply With Quote
Old 11-14-2007, 06:38 AM   #5 (permalink)
The Contributor
 
dschreck's Avatar
 
Join Date: Nov 2007
Location: California
Posts: 82
Thanks: 0
dschreck is on a distinguished road
just as a side note, not going to say ignorance is acceptable, but you'll rarely need to really consider which type of join you will need. Often enough, it is adequate enough to just simple come up with a query that resembles :

Code:
MySQL:

select 
    table1.* 
from 
   table1 
join 
   table2 
 on 
   (table1.specific_detail = table2.id)
where 
   table1.id = 5
and generally, this type of syntax will give you the results you desire.
But yes, learn the types of joins just in case things go.. askew.
dschreck is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:00 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design