(在php中使用mysql)
嗨,我似乎无法通过谷歌或在这个网站上找到答案,所以非常感谢帮助。 我正在尝试加入2个桌子,一起显示学生的名字,然后按字母顺序排序,我还没有得到帮助,如何做到这一点也赞赏:D。 所需的所有信息都在这里
id设置为INT NOT NULL AUTO_INCREMENT并且是StudentID设置为INT的PRIMARY KEY ,Name设置为VARCHAR(30) ,age也设置为INT 。
我的问题是,为什么以下的PHP脚本没有显示任何结果? 除了桌子? 我正在使用wamp。
(Using mysql in php)
Hi people i cant seem to find the answer through google or on this site so help is much appreciated. I'm trying to join 2 tables together displaying JUST the name of students, then to order it alphabetically which i havent gotten into yet help on how to do that is also appreciated :D. All info needed is here
the id is set to INT NOT NULL AUTO_INCREMENT and is the PRIMARY KEY the StudentID is set to INT the Name is set to VARCHAR(30) and the age is set to an INT as well.
My question is, why is the following php script not displaying any results? besides the table? I am using wamp.
最满意答案
您需要UNION两个结果并在其上应用ORDER ,例如:
SELECT Name FROM( SELECT Name FROM Group1 UNION SELECT Name FROM Group 2 ) a ORDER BY a.Name;You need to UNION both the results and apply ORDER on it, e.g.:
SELECT Name FROM( SELECT Name FROM Group1 UNION SELECT Name FROM Group 2 ) a ORDER BY a.Name;更多推荐
发布评论