Extracting data from the Synergetic database
Extracting data from the Synergetic database
Extracting data from the Synergetic database
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<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 6 - Select enrolment changes in <strong>the</strong> last seven days<br />
You can also use <strong>the</strong> following statement to select records changed during <strong>the</strong> previous day(s). This<br />
statement will only work in <strong>the</strong> current year – that is, you cannot select records changed before <strong>the</strong><br />
current year. The query uses <strong>the</strong> SQL DATEPART function to calculate <strong>the</strong> date range required.<br />
Query<br />
SELECT vFCA.FutureSurname, vFCA.FuturePreferred, vFCA.FutureGender,<br />
vFCA.FutureContactType, vFCA.FutureContactDescription, vFCA.FutureContactMailName,<br />
vFCA.FutureContactMailSalutation, vFCA.FutureContactAddressFull,<br />
vFCA.FutureApplicationDate, vFCA.FutureEnrolYear, vFCA.FutureStatus,<br />
vFCA.FutureCampus, vFCA.FutureYearLevel<br />
FROM SynergyOne.dbo.vFutureContactAddress vFCA<br />
WHERE<br />
(DATEPART(Year,FutureStatusChangeDate) >= DATEPART(Year,GETDATE())) AND<br />
(DATEPART(DayofYear,FutureStatusChangeDate) >=<br />
(DATEPART(DayofYear,GETDATE() -6))<br />
Page 6-70 Version 60