MYSQL Inner Join with possible empty tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Deluca
    New Member
    • Nov 2010
    • 2

    MYSQL Inner Join with possible empty tables

    Hi everyone,

    I am using the following query to retrieve member profile data:

    Code:
    SELECT * FROM Members 
    							INNER JOIN MemberMartialArts on MemberMartialArts.mma_memberId = '$memberId'
    							INNER JOIN MemberAbilities on MemberAbilities.ma_memberId = '$memberId'
    							 WHERE m_id = '$memberId'
    My problem is the tables, MemberMartialAr ts and MemberAbilities may possibly have no records where memberId = '$memberId'.

    I do not want to use three separate queries because as tested the speed was slower.

    Can anyone comment how I can modify this query to to make it work even of one of the table do not contain a memberId..

    Thanks,
    Joe
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    what you want are outer joins as opposed to "inner"

    I knew a Joe Deluca back in high school in Ohio... No chance is there?

    Comment

    • Joe Deluca
      New Member
      • Nov 2010
      • 2

      #3
      Thanks man that did the trick.

      And no I'm from Canada ;)

      Comment

      Working...