How can an SQL query return data from multiple tables
        Posted  
        
            by 
                Fluffeh
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Fluffeh
        
        
        
        Published on 2012-09-18T11:11:39Z
        Indexed on 
            2012/09/22
            9:37 UTC
        
        
        Read the original article
        Hit count: 230
        
I would like to know how to get data from multiple tables in my database, what types of methods are there to do this, what are joins and unions and how are they different from one another? When should I use each one compared to the others?
I am planning to use this in my (for example - PHP) application, but don't want to run multiple queries against the database, what options do I have to get data from multiple tables in a single query?
Note: I am writing this as I would like to be able to link to a well written guide on the numerous questions that I constantly come across in the PHP queue, so I can link to this for further detail when I post an answer.
The answers cover off the following:
© Stack Overflow or respective owner