将结果显示在一行中 [英] displaying result in a single row
问题描述
我在Myswl数据库中有一个名为''animal_prize''的表。
列/字段是:
''animal_event_id''包含诸如1之类的数字
''animal_place''包含从1到10的数字
''animal_prize_money''包含数字,例如10
我想得到的结果如下所示:
animal_event_id 1st 2nd 3rd
1 30 20 10
2 40 30 20
这只是为了在每个赛事中显示前3个地方的奖金。
感谢您的帮助。
I have a table called ''animal_prize'' in a Myswl database.
The columns / fields are:
''animal_event_id'' contains numbers such as 1
''animal_place'' contains numbers from 1 to 10
''animal_prize_money'' contains numbers such as 10
I am trying to get the results so that it appears like the following:
animal_event_id 1st 2nd 3rd
1 30 20 10
2 40 30 20
It is only meant to show the top 3 places with the prize money for that place, in each event.
Thanks for your help.
推荐答案
查看MySQL命令 ORDER BY 和 LIMIT
Have a look at MySQL commands ORDER BY and LIMIT
这些命令没那么有用。
''1st'',''2nd''和''第三"从''animal_prize_money'获得金额。
''1st'',''2nd''和''3rd'来自''animal_place''。
结果应该像某些东西,比如
''animal_event_id''''1st'''''2nd'''' '3rd''
1 30 20 10
如果地点是1,那么1st应该说30之类的东西。
如果地方是2,那么第二,应该说类似20的东西。
如果地方是3,那么 ;第3个,应该说30个。
感谢您的帮助。
Those commands were not that helpful.
The ''1st'', ''2nd'', and ''3rd" gets the amount from ''animal_prize_money''.
The ''1st'', ''2nd'', and ''3rd" is from ''animal_place''.
The result should be somehting like
''animal_event_id'' ''1st'' ''2nd'' ''3rd''
1 30 20 10
If the place is 1, then "1st", should say something like 30.
If the place is 2, then "2nd", should say something like 20.
If the place is 3, then "3rd", should say something like 30.
Thanks for you help.
这篇关于将结果显示在一行中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!