Created
May 6, 2014 11:50
-
-
Save normansolutions/15323e3d9ee242561338 to your computer and use it in GitHub Desktop.
For use on blog post: http://normansolutions.co.uk/post/schoolbase-rewards--sanctions-via-email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW DBA_RandSView | |
AS | |
SELECT TOP (100) PERCENT Sanctions.Sanction | |
,Pupil.Pu_Surname | |
,Pupil.Pu_GivenName | |
,Years.YearDesc | |
,PupSanction.PupSanDate | |
,PupSanction.PupSanCount | |
,PupSanction.PupNewNote | |
,Staff.UserName | |
,Sanctions.SanIdent | |
,Pupil.PupOrigNum | |
,PupSanction.PupSanNote | |
FROM dbo.PupSanction AS PupSanction | |
INNER JOIN dbo.Staff AS Staff ON PupSanction.UserIdent = Staff.UserIdent | |
INNER JOIN dbo.Pupil AS Pupil ON PupSanction.PupOrigNum = Pupil.PupOrigNum | |
INNER JOIN dbo.Sanctions AS Sanctions ON PupSanction.SanIdent = Sanctions.SanIdent | |
INNER JOIN dbo.Years AS Years ON Pupil.YearIdent = Years.YearIdent | |
ORDER BY Years.YearDesc | |
,PupSanction.PupSanDate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment