SELECT * 
						FROM question 
						LEFT JOIN answer ON question.Que_ID=answer.Que_ID 
						AND question.Que_Answer1=answer.Ans_Answer1 
						AND question.Que_Answer2=answer.Ans_Answer2 
						AND question.Que_Answer3=answer.Ans_Answer3
						AND question.Que_Answer4=answer.Ans_Answer4
						
						AND question.Tes_ID=7
AND answer.Use_ID=1

This should only show record that are use_ID=1 and Tes_ID =7. But in MySQL, there are data for test ID=8 and etc. isnt it only suppose to be 7.

The code you have is selecting every record from question and only joining info from records in answer that match the criteria. I think what you ar looking for would be:

SELECT * 
FROM question 
LEFT JOIN answer ON question.Que_ID=answer.Que_ID 
AND question.Que_Answer1=answer.Ans_Answer1 
AND question.Que_Answer2=answer.Ans_Answer2 
AND question.Que_Answer3=answer.Ans_Answer3
AND question.Que_Answer4=answer.Ans_Answer4
WHERE				
question.Tes_ID=7
AND answer.Use_ID=1

thank you :d

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.