我该怎么做这个查询? [英] How do I do this query?
问题描述
我希望我知道这叫做什么,我本可以做出更明智的
主题。就此而言,我知道它叫什么,我可以用谷歌搜索它!
无论如何,让我有一张名字,类,等级的桌子。
joe bio a
jill chem b
john psych b
john chem a
jill pysch a
我希望将结果显示为
名称bio psych chem
joe a - -
jill - ab
john - ba
有没有办法用sql做到这一点?怎么样用PHP的SQL?
非常感谢!
Manny
-
manny @不要发垃圾邮件
I wish I knew what this was called, and I could have made a more sensible
subject. For that matter, I knew what it was called, I could have googled it!
Anyway, let''s I have a table with name, class, grade.
joe bio a
jill chem b
john psych b
john chem a
jill pysch a
and I want to display the results as
name bio psych chem
joe a - -
jill - a b
john - b a
Is there a way to do this with sql? How about sql with php?
Thanks much!
Manny
--
manny@don''t spam on me
推荐答案
manny写道:
无论如何,让我来吧有一张名字,班级,等级的桌子。
joe bio a
jill chem b
john psych b
john chem a
jill pysch a
我希望将结果显示为
名称生物心理化学
joe a - -
jill - ab
john - ba
有没有办法用sql做到这一点?如何使用php进行sql?
Anyway, let''s I have a table with name, class, grade.
joe bio a
jill chem b
john psych b
john chem a
jill pysch a
and I want to display the results as
name bio psych chem
joe a - -
jill - a b
john - b a
Is there a way to do this with sql? How about sql with php?
创建新表(name = key),使用insert
在新表中插入旧数据。 ...选择和一式两份条款,请参阅
http:// dev .mysql.com / doc / refman / 4.1 / en / insert.html
-
E. Dronkert
Create new table (name=key), insert old data in new table using "insert
.... select" and "on duplicate" clause, see
http://dev.mysql.com/doc/refman/4.1/en/insert.html
--
E. Dronkert
使用PHP和MySQL显示它会相当容易。这是我要使用的
算法:
To display it is going to be fairly easy with PHP and MySQL. Here''s the
algorithm I''d use:
sql =" SELECT * FROM table_name" ;;
sql = "SELECT * FROM table_name";
这篇关于我该怎么做这个查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!