Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm sure there are people on this s

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm sure there are people on this site who are much more adept at mySQL queries than I, and I'm hoping someone can provide me with a solution to my problem before I go completely insane. What I need is to somehow combine the following two queries:

$sql = "SELECT C.id,C.content
FROM answers A, question Q, choices C
WHERE A.response_id='$rid'
AND A.question_id=Q.id
AND A.choice_id=C.id
AND C.content NOT LIKE '!other%'
ORDER BY C.id";

$other_sql = "SELECT C.id,O.response AS content
FROM answers_other O, question Q, choices C
WHERE O.response_id='$rid'
AND O.question_id=Q.id
AND O.choice_id=C.id
AND C.content LIKE '!other%'
ORDER BY C.id";

Doing each query seperately works correctly, but what I really need is to combine these queries so I have only 1 result set to work with.

I'm assuming the structures and fields can be seen by looking at the queries. I don't want to add further confusion by explaining something wrong, but I can certainly answer any questions about the table structures and fields if need be. I would GREATLY appreciate any possible solutions, as this is a final stumbling block for this particular project. Thanks very much in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top