本文介绍了我该怎么做这个查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我知道这叫做什么,我本可以做出更明智的

主题。就此而言,我知道它叫什么,我可以用谷歌搜索它!


无论如何,让我有一张名字,类,等级的桌子。


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

推荐答案




创建新表(name = key),使用insert

在新表中插入旧数据。 ...选择和一式两份条款,请参阅



-

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




这篇关于我该怎么做这个查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-02 14:17