The Outer Limits of SQL JOINs
Subject:   Left Join
Date:   2006-02-22 07:43:25
From:   RathnaAsh
I'm using left join to display results when there is no value in the right table. But I'm not getting any records. I'm running the following query in SQL Server:
a.prono, a.stateabrev, a.agname, isnull(count(distinct p.policy_number),0)uploadpolicies
FROM agency_info a LEFT OUTER JOIN policy p
ON a.prono = p.agency_code
Where a.prono = '4444032'
and isnull(p.status, '') = 'C' and isnull(p.state, '') like 'VT'
and isnull(p.POS_Status, '') <> ''
and ltrim(rtrim(len(isnull(p.policy_number, ''))))=7
and isnull(p.received_at_aig, '9999-12-31') between '2006-01-16' and '2006-02-10'
group by a.prono, a.stateabrev, a.agname

1 to 1 of 1
1 to 1 of 1