Last active
October 14, 2016 09:29
-
-
Save firstfu/c649ed2165ccbef4299f07ea81f40709 to your computer and use it in GitHub Desktop.
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
##四個表連結use —> inner join | |
SELECT a.number, a.name, a.animalMain, d.caseType, c.caseContent, c.caseQuestion, c.caseAnimal | |
from TestHistory as a | |
INNER JOIN TestDetail as b | |
ON a.name = b.name | |
INNER JOIN CaseQuestion as c | |
ON b.questionInfo = c.caseNumber | |
INNER JOIN CaseAnalyze as d | |
ON c.caseContent = d.caseContent | |
##三個表聯結use —> inner join | |
SELECT c.name | |
from content_type_ad_apply_form as a | |
INNER JOIN node as b | |
ON a.nid = b.nid | |
INNER JOIN users as c | |
ON b.uid = c.uid | |
##不含排序 | |
select FirstQuestion.number, FirstQuestion.question, FirstQuestion.starNameOne, Animals.explain | |
from FirstQuestion | |
left join Animals | |
on FirstQuestion.starNameOne = Animals.animalName | |
##含排序—ORDER By | |
select * from CaseAnalyze | |
left join CaseQuestion | |
on CaseAnalyze.caseContent == CaseQuestion.caseContent | |
ORDER By CaseAnalyze.caseNumber, CaseQuestion.caseNumber |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment