Microsoft SQL Query Example

SELECT DISTINCT R.CONSTITUENT_ID, R.FIRST_NAME, R.LAST_NAME, AD.ADDRESS_BLOCK, AD.CITY,
AD.STATE, AD.POST_CODE, AD.DPC

FROM RECORDS R
LEFT OUTER JOIN CONSTIT_ADDRESS CA ON CA.CONSTIT_ID = R.ID AND CA.PREFERRED = -1 -- Preferred Address is true
LEFT OUTER JOIN DBO.ADDRESS AD ON CA.ADDRESS_ID = AD.ID

WHERE R.KEY_INDICATOR = 'I' -- Record type of Individuals = I , Organizations = O


Microsoft Access Query Example

SELECT

DISTINCT dbo_RECORDS.CONSTITUENT_ID, dbo_RECORDS.FIRST_NAME, dbo_RECORDS.LAST_NAME, dbo_ADDRESS.ADDRESS_BLOCK, dbo_ADDRESS.CITY, dbo_ADDRESS.STATE, dbo_ADDRESS.POST_CODE, dbo_ADDRESS.DPC


FROM

dbo_RECORDS INNER JOIN (dbo_ADDRESS INNER JOIN dbo_CONSTIT_ADDRESS ON dbo_ADDRESS.ID = dbo_CONSTIT_ADDRESS.ADDRESS_ID) ON dbo_RECORDS.ID = dbo_CONSTIT_ADDRESS.CONSTIT_ID;

 

Disclaimer: Blackbaud provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Structured Query Language and the tools used to create and modify SQL statements and Crystal Reports. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.