I have the code below which works fine and outputs in report format using sql reporting.
I also have a lookup table of postcodes (CTS_POSTCODES) which has a column Postcode with hunderds of rows such as
M1 2AL
M1 2BZ
M12 2RT
etc etc
what i'd like to do is group the report by postcode (corpostcode column from the report) that match to an entry in the CTS_POSTCODES. and have those that don't find a match group those also.
any ideas ?
thanks
chris
I also have a lookup table of postcodes (CTS_POSTCODES) which has a column Postcode with hunderds of rows such as
M1 2AL
M1 2BZ
M12 2RT
etc etc
what i'd like to do is group the report by postcode (corpostcode column from the report) that match to an entry in the CTS_POSTCODES. and have those that don't find a match group those also.
any ideas ?
thanks
chris
Code:
SELECT a.customerid, LEFT(c.titledesc, 8) AS Title, LEFT(a.firstname, 16) AS Firstname, LEFT(a.surname, 20) AS Surname, CONVERT(char(15),
b.sdate, 102) AS Start_date, CASE LEFT(b.coraddress1 + ',' + b.coraddress2 + ',' + b.coraddress3 + ',' + b.coraddress4 + ',' + corpostcode,
60) WHEN ',,,,' THEN ' ' ELSE LEFT(b.coraddress1 + ',' + b.coraddress2 + ',' + b.coraddress3 + ',' + b.coraddress4 + ',' + corpostcode, 60)
END AS Manual_Address, corpostcode
FROM cts_customers a, cts_cust_addr b, cts_cust_titles c
WHERE a.customerid = b.customer AND a.CREATING_AUTHORITY = 'CH' AND a.title = c.titleid AND b.edate IS NULL AND b.UPRN IS NULL
ORDER BY start_date