Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

MySQL join two tables nulls on both tables

Avatar of hbojorquezgeek
hbojorquezgeek asked on
PHPMySQL ServerSQL
11 Comments1 Solution432 ViewsLast Modified:
I think I'm asking the question right here are the tables and hoped for results
 
Table 1
StandardQuestions
|      QID      |       QuestionType             | Question
|      1      |      GeneralKnowledge            | Who is President of   a?
|      2      |      GeneralKnowledge            | Who is President of  b ?
|      3      |      GeneralKnowledge            | Who is President of  c?
|      4      |      GeneralKnowledge            | Who is President of  d ?
|      5      |      GeneralKnowledge            | Who is President of  e ?
|      6      |      GeneralKnowledge            | Who is President of  f ?



Table2
ChosenQuestions
|      ChID|       QID         |      Question
|      1      |      4            | Who is President of  d ?
|      2      |      5            | Who is President of  e ?
|      3      |      6            | Who is President of  f ?
|      4      |      NULL      | Who is President of  Mumbai?



Result
CHID      |      QID      |       QuestionType             | Question                   
NULL      |      1      |      GeneralKnowledge            | Who is President of   a?  
NULL      |      2      |      GeneralKnowledge            | Who is President of  b ?
NULL      |      3      |      GeneralKnowledge            | Who is President of  c?                      
1              |      4      |      GeneralKnowledge            | Who is President of  d ?    
2              |      5      |      GeneralKnowledge            | Who is President of  e ?|
3              |      6      |      GeneralKnowledge            | Who is President of  f ?
4              |      NULL|      NULL                        | Who is President of  Mumbai?


Table 1 Questions are pretty immutable- rarely change- user chose them into Table 2- They also add their OWN questions into table 2 - The NULL QID  denotes that it wasn't chosen from Table 1.

I need a summary table that includes ALL the Table 1 questions- with NULLS in the CHID column  to show they  weren't chosen , and a NULL in   the QUID for questions from Table 2 that were entered by users.

I would not have designed these tables like this but I've inherited the schema.

 
Please help,,,,,, I'm super desperate- I'm using MySQL
ASKER CERTIFIED SOLUTION
Avatar of NerdsOfTech
NerdsOfTechFlag of United States of America imageTechnology Scientist

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answers