Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6146865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:01:10+00:00 2026-05-23T19:01:10+00:00

I am fairly new to php and mysql and am having an issue with

  • 0

I am fairly new to php and mysql and am having an issue with a query.

SELECT candidate_id.master_id, candidate_contact_details.first_name,
candidate_contact_details.last_name,
candidate_contact_details.home_phone FROM candidate_id,
candidate_contact_details, qualifications WHERE qualifications.active = 'yes';

The database only has 2 records across 5 tables but this is returning 12 results in both php and directly on the mysql console. I know I am doing something wrong but cannot figure it out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:01:12+00:00Added an answer on May 23, 2026 at 7:01 pm

    you need to make the query consistent.
    the query you have is the Cartesian product of all your tables which in most of the case doesn’t make much sense

    here is something better (assuming that master_id is the reference to a candidate instance):

    SELECT candidate_id.master_id, candidate_contact_details.first_name,
    candidate_contact_details.last_name,
    candidate_contact_details.home_phone
    FROM candidate_id, candidate_contact_details, qualifications
    WHERE qualifications.active = 'yes' AND candidate_id.master_id = candidate_contact_details.master_id AND qualifications.master_id = candidate_id.master_id;
    

    even better would be use JOIN and use alias for table name to make code more readable:

    SELECT c.master_id, cc.first_name,cc.last_name,cc.home_phone
    FROM candidate_id c
       JOIN candidate_contact_details cc
         ON c.master_id = cc.master_id
       JOIN qualifications q
         ON c.master_id = q.master_id
    WHERE q.active = 'yes';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, so I'm fairly new to PHP and SQL/MySQL so any help is appreciated.
I'm fairly new to php and mysql and I'm on the home stretch of
I am fairly new to PHP and mysql and was wondering if I could
I'm fairly new to PHP and MySQL (experienced with other languages). Basically I want
Ok, so I am fairly new to php and mysql. I am creating a
I'm fairly new to PHP and I am trying to return an array from
I'm fairly new to MySQL and don't know how to write a query I
To put it simply i am a fairly new PHP coder and i was
I'm fairly new to php and was wondering how do I validate the array
I'm fairly new to PHP and MongoDB so it would be really helpful if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.