I have these tables.
tables
#__qa_question
qid,
user_id,
date_add,
date_modify,
question,
publish
#__qa_answer
aid,
operator_id,
date_add,
date_modify,
answer,
publish
#__qa_category
catid,
name,
publish
#__qa_answer_xref
id,
qid,
aid
#__qa_category_xref
id,
catid,
qid
How can Join these table question,category,answer get the following result
s/n Question date publish user name category answer publish
1 x xxx no xxxxx xxxx xx yes
select
q.question as question,
q.date_add as date,
q.publish as publish,
q.user_id as user,
qcat.name as category,
qans.answer as answer,
qans.publish as anspublish
from
#__qa_question as q,
#__qa_category_xref as qcatref,
#__qa_category as qcat,
#__qa_answer_xref as qansref
#__qa_answer as qans
where
q.qid = qcatref.qid
and qcat.catid = qcatref.catid
and q.quid = qansref.qid
and qans.aid = qansref.aid