Skip to content

Instantly share code, notes, and snippets.

@rts-rob
Created September 11, 2017 06:25
Show Gist options
  • Save rts-rob/c38a71d96a9650415f1592e99953e0dd to your computer and use it in GitHub Desktop.
Save rts-rob/c38a71d96a9650415f1592e99953e0dd to your computer and use it in GitHub Desktop.
Example of an INNER JOIN across three tables
CREATE VIEW ClassesAndRunningInformation AS
SELECT
ClassGroup.Name AS ClassGroupName,
Running.StartDate,
Module.Name AS ModuleName,
Module.Length AS ModuleLength
FROM
ClassGroup
INNER JOIN
Running
ON ClassGroup.Id = Running.ClassGroup_Id
LEFT JOIN
Module
ON Running.Module_Id = Module.Id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment