SQL Code for Student Emails

SQL Code for Student Emails

The change in student contacts requires a change in code for the student email. Unfortunately, this isn't great for combining DAT for contacts and student data in one. When you use List Students, for example, you can use the DAT Builder to get the contact information, but the student email is no longer in the Field List.  You have to be able to refer to the psm_studentcontact table.

select s.whatever,  con.email
from psm_studentcontact con 
join psm_studentcontacttype ct on ct.id = con.studentcontacttypeid
join sync_studentmap ss  on con.studentid = ss.studentid
join students s on s.dcid = ss.studentsdcid
where s.enroll_status=0 
and ct.name = 'Self'
order by s.lastfirst

    • Related Articles

    • Primary Contacts Email and Phone with Demographihcs

      SqL Reports/Contacts3 This report shows data for either the current school or the current selection.   The report shows the primary contact and demographic info for students - it will display None if there is no contact - and the primary email ...
    • Primary Contacts Email and Phone

      SQL Reports/Contacts/Primary Contacts Email and Phone This report will return the active contacts for students and the primary email address and phone number for each contact.
    • Student Emails

      Per Melissa PSUG You have to use Data Import Manager, and upload to the dataset "Student Email". Your spreadsheet must have StudentsDCID and their email address.
    • Students - Contacts List

      PSCB Reports/Contacts Contact Information - relationship, phone 1, 2, 3, email, data access, custody, lives with, mail, emergency contact, pickup Same report information as with SQLReports/Contacts/Student Contact Information but this one has a ...
    • Race and Ethnicity Code for Queries

      Race/Ethnicity - How it Works Kudos to Roger This code auto fills the Ethnicity column with MULT for students with multiple races. CASE when s.fedethnicity = 0 then     CASE            WHEN s.id in (                  select studentid                 ...