Hi,
below queries gives two rows like
category_name high_value_complaints
category_name high_value_duplicate_complaints
I am trying to merge both queries
category_name high_value_complaints high_value_duplicate_complaints
I tried to join both tables but its giving
category_name high_value_complaints category_name high_value_duplicate_complaints
Need suggestions
select category_name, count(distinct complaint3.id ) as high_value_complaints
from complaint_category,assignment3,user3,complaint3_details, complaint3,complaint_tag ct
where
complaint3.complaint_category_id=complaint_category.id
and complaint3.id=complaint3_details.complaint_id
and ct.complaint_id=complaint3.id
and assignment3.assigned_to=user3.id
and ct.tag_id IN (select tag.id from tag , tag_value where tag_value.tag_value like '%Irrelevant%'
and tag.tag_value_id = tag_value.id)
and assignment3.id = (select min(id) from assignment3 where assignment3.complaint_id = complaint3.id)
and complaint3_details.disputed_amount>5000
and complaint3.created_at>='20131101' and complaint3.created_at<='20131131'
group by category_names
select category_name, count(distinct complaint3.id ) as high_value_duplicate_complaints
from complaint_category,assignment3,user3,complaint3_details, complaint3,complaint_tag ct
where
complaint3.complaint_category_id=complaint_category.id
and complaint3.id=complaint3_details.complaint_id
and ct.complaint_id=complaint3.id
and assignment3.assigned_to=user3.id
and ct.tag_id IN (select tag.id from tag , tag_value where tag_value.tag_value like '%Duplicate%'
and tag.tag_value_id = tag_value.id)
and assignment3.id = (select min(id) from assignment3 where assignment3.complaint_id = complaint3.id)
and complaint3_details.disputed_amount>5000
and complaint3.created_at>='20131101' and complaint3.created_at<='20131131'
group by category_names
jacob21 0 Posting Whiz in Training
BenWard 8 Newbie Poster
jacob21 0 Posting Whiz in Training
BenWard 8 Newbie Poster
jacob21 0 Posting Whiz in Training
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.