gpt4 book ai didi

jquery - 将 MySQL/JSON 数据转换成表

转载 作者:行者123 更新时间:2023-11-30 23:34:07 25 4
gpt4 key购买 nike

比主题要复杂一些。我基本上是在运行一个返回 4 列数据的 SQL 查询。最后一列是一个数字,前 3 列包含有关数字的信息。

具体来说:

Col1: Question Text
Col2: Info Type
Col3: Banner
Col4: Average

所以我正在查询一个大型数据集以获得一堆项目的平均分数。

我可能会查询以获取 Q1 和 Q2 的结果,其中信息类型是最爱或第二最爱,横幅是加拿大和美国。

我希望我的输出表看起来像:

               |Canada           |USA
Q1 | Favourite | Average Score | Average Score
Q1 | SecondFav | Average Score | Average Score
Q2 | Favourite | Average Score | Average Score
Q2 | SecondFav | Average Score | Average Score

我正在寻找一种方法(可能是插件或实用程序),我可以指定在行中使用哪些数据,在列中使用哪些数据。

不确定这有多清楚,感谢任何帮助。

最佳答案

您可以在 mysql 中执行此操作,只需使用 CASE 语句将您的行转换为列,例如:

 Select col1 as 'Question', col2 as 'Info Type',
case when Col3 = 'Canada' then col4 end as 'Canada',
case when Col3 = 'USA' then col4 end as 'USA'
from yourTableName

关于jquery - 将 MySQL/JSON 数据转换成表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9020137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com