sql - How to populate data from a table, depending upon another table -
my question super straight,
i have table naming faq_master having data of faqs
i have table naming faq_override having data of overrided faqs foreign key company_id different table
now want populate data faq_master, if faq_override not populating data depending upon company_id fetched session variable
if faq_override populating data, populating data faq_master not required.
i want run query in postresql
what have tried :
select * ( select distinct fm.faq_uid faquid, case when fm.qa_text not null fm.qa_text else fm.qa_text end qatext, case when fm.sort_order not null fm.sort_order else fm.sort_order end sortorder, fm.end_date enddate rnr.faq_master fm ) faq_qry left outer join rnr.company_faq_override fo on faq_qry.faquid = fo.faq_override_uid , fo.mp_company_uid = 734 faq_qry.enddate null , ( faq_qry.mp_company_uid null or fo.mp_company_uid = 734 ) order faq_qry.sortorder
Comments
Post a Comment