Extracting data from the Synergetic database
Extracting data from the Synergetic database
Extracting data from the Synergetic database
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Extracting</strong> <strong>data</strong> <strong>from</strong> <strong>the</strong> <strong>Synergetic</strong> <strong>data</strong>base<br />
Advanced Microsoft Query and SQL examples<br />
Example 1 - Use SUBSTRING with a character string<br />
This example shows how to return only a portion of a character string.<br />
From <strong>the</strong> vStudentClasses view, this query returns records filtered based on a portion of <strong>the</strong> class<br />
code.<br />
Query<br />
SELECT<br />
vSC.StudentID, vSC.StudentSurname, vSC.StudentPreferred,<br />
vSC.StudentCampus, vSC.StudentHouse, vSC.ClassCampus, vSC.ClassCode,<br />
vSC.ClassDescription<br />
FROM vStudentClasses vSC<br />
WHERE (substring(vSC.ClassCode,1,2)='MA')<br />
ORDER BY<br />
vSC.StudentSurname,<br />
vSC.StudentPreferred<br />
The WHERE substring statement selects MA because <strong>the</strong>re is a character match starting <strong>from</strong><br />
position one which includes two characters of <strong>the</strong> class code.<br />
Page 6-64 Version 60