I have the query below and the county isn't working. Any help is greatly appreciated. The county table has the actual name which is what I need.
SELECT o.ObservationID, (CASE WHEN st.SiteName = 'My Site' THEN (SELECT County FROM County WHERE sc.CountyID = County.CountyID) ELSE (SELECT County FROM County WHERE s.SiteID = County.CountyID) END) AS County FROM Observation o LEFT JOIN ObservationPermit p ON o.ObservationID = p.ObservationID LEFT JOIN ObservationSite s ON o.ObservationID = s.ObservationID LEFT JOIN [Site] st ON s.SiteID = st.SiteID LEFT JOIN SiteCounty sc ON st.SiteID = sc.SiteID LEFT JOIN County c ON sc.CountyID = c.CountyID WHERE ProjectID = 103
*** Please allow me to mark threads as answered and I will, Thank you ***