select 
        P.NUM,
        T.DESCRIPTION
from
 ADDRESSLINKS AL
 
--Joins to link a student's parent or guardian
--to their phone numbers
join PHONELINKS PL on
        PL.ADDRESSLINKSID = AL.ADDRESSLINKSID
join ADDRESSLINKPHONES P on
        P.PHONESID = PL.PHONESID
join TABLEENTRIES T on
        T.TABLEENTRIESID = P.PHONETYPE
join EA7RECORDS R on
        R.EA7RECORDSID = AL.PARENTRECORDID
       
--Linking a student to their parent or guardian
join EA7RELATIONSHIPS REL on
  REL.PARENTID = R.EA7RECORDSID
join EA7RECORDS R2 on
  R2.EA7RECORDSID = REL.RELATIONID
  
where
 --Relationship codes for Father, Mother, and Guardian
 REL.RECIPROCALCODE in (333, 735, 1578)
 and
 --Student's record ID
 R2.EA7RECORDSID = 607
 --Tableentries for Home and Cell phone numbers
 and T.TABLEENTRIESID in (96, 98)


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 that you are familiar with Structured Query Language and the tools used to create and modify SQL statements. Blackbaud Customer Support can help explain the functionality of a particular procedure but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the Read Only Database Assistance (RODBA), contact your Account Representative at solutions@blackbaud.com.