Here I am facing a performance issue...I have around 15000 emp_numbers sitting in one table called
tbl_emp_numbers and I need to use a query for summary report.basically its for knowing how much entry
has been done in each table.The case I have written here is 3 but there are 10 more with similar situations
and each app_count,po_count etc wants basically a return saying whether this emp_number is captured in here
if captured return 1 else return 0.Is there any way to increase the performace..This is dead slow
select a.emp_number,
case
when a.associate_name is null then ' '
else a.associate_name
end as associate_name,
case
when (select count(*) from tbl_app_info where emp_number = a.emp_number) > 0 then 1
else 0
end as app_count,
case
when (select count(*) from tbl_po_info where emp_number = a.emp_number) > 0 then 1
else 0
end as po_count,
from tbl_emp_numbers a
where (associate_name is null or associate_name <> 'test')
and application_type = 'TY'
order by associate_name
tbl_emp_numbers and I need to use a query for summary report.basically its for knowing how much entry
has been done in each table.The case I have written here is 3 but there are 10 more with similar situations
and each app_count,po_count etc wants basically a return saying whether this emp_number is captured in here
if captured return 1 else return 0.Is there any way to increase the performace..This is dead slow
select a.emp_number,
case
when a.associate_name is null then ' '
else a.associate_name
end as associate_name,
case
when (select count(*) from tbl_app_info where emp_number = a.emp_number) > 0 then 1
else 0
end as app_count,
case
when (select count(*) from tbl_po_info where emp_number = a.emp_number) > 0 then 1
else 0
end as po_count,
from tbl_emp_numbers a
where (associate_name is null or associate_name <> 'test')
and application_type = 'TY'
order by associate_name