Skip to content

Instantly share code, notes, and snippets.

@hpcslag
Last active April 9, 2016 05:17
Show Gist options
  • Save hpcslag/069e230fa8e23fe0ae933daf4cde086c to your computer and use it in GitHub Desktop.
Save hpcslag/069e230fa8e23fe0ae933daf4cde086c to your computer and use it in GitHub Desktop.
比賽表,兩筆資料從一張表搜尋(國家),一張表的兩筆資料,參照替換成第二張表的參考
SELECT G.Home, G.Away,
C1.CountryName, C2.CountryName
FROM Game G
JOIN Country C1 ON C1.CountryID = G.Home
JOIN Country C2 ON C2.CountryID = G.Away;
--http://stackoverflow.com/questions/4267929/whats-the-best-way-to-join-on-the-same-table-twice
@hpcslag
Copy link
Author

hpcslag commented Apr 9, 2016

d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment