xxreenaxx1 0 Junior Poster in Training
SELECT *
FROM user u, subject s, test t, question q, answer a
WHERE u.Use_ID =1
AND t.Sub_ID =1
AND s.Sub_ID = t.Sub_ID
AND a.Que_ID = q.Que_ID

I would like to check if the a.Que_ID =q.Que_ID does not exist then it should do the rest of the query.
So far I have

SELECT *
	FROM subject AS s
	JOIN test AS t
        ON s.Sub_ID   = t.Sub_ID
	WHERE NOT EXISTS
	(SELECT *
         FROM question AS q
         JOIN answer AS a
         ON q.Que_ID = a.Que_ID
         WHERE t.Sub_ID=$subjectid)
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.