The query below is created by someone else but is running long so need to improve the performance. Can you please suggest me a better way to do?
Select * from ps_vendor G where G.vendor_id NOT IN (SELECT vendor_id
FROM ps_voucher_line
WHERE vendor_id <> '70830'
AND cntrct_id <> ' '
AND vendor_id NOT IN (SELECT vendor_id
FROM ps_cntrct_hdr
WHERE
cntrct_type = 'AP'))
Please try with inner join condition like display below
Try different variations in joining condition!!
Good is that you have sub query to verify results.