Type: MSSQL
Description: Find Primary Email Addresses for State and Contact Type LIKE (type in whole or partial words between the percent signs)
SELECT
c1.contact
,cs.contsupref
,cs.accountno
,c1.lastname
,c1.key1 AS ContType
FROM
contact1 c1
JOIN contsupp cs
ON c1.accountno=cs.accountno
WHERE
cs.contact='E-mail Address'
AND SUBSTRING(cs.zip FROM 2 FOR 1) = '1'
AND c1.STATE IN ('MA')
AND (c1.key1 LIKE '%Instr%'
OR c1.key1 LIKE '%Stu%')
ORDER BY
c1.lastname