/* Shows all active customers with notes */
SELECT
CASE WHEN N.line_no = 1 THEN n.customer_code ELSE '' END AS [COMPANY CODE],
CASE WHEN N.line_no = 1 THEN C.OrganisationV6 ELSE '' END AS [COMPANY NAME],
N.line_no AS LINE,
N.text_line AS NOTE
FROM tblCustnote N
LEFT OUTER JOIN tblCust C on c.Customer_code = n.customer_code
where isnull(c.customer_code,'') <> '' and c.DisabledCust = 'N'
order by N.customer_code, N.line_no