gpt4 book ai didi

mysql - 我如何在mysql中传输表

转载 作者:行者123 更新时间:2023-11-29 17:14:33 24 4
gpt4 key购买 nike

Table column structure

这是我的查询:

select count(id) as Agendas, (select count(id) from publications) as Publication, (select count(id) from achievements) as Achievements from agenda_details

如何在以下 View 中获取结果?

| serial No|  Category     | Counts|
| 1 | Agendas | 5 |
| 2 | Publications | 5 |
| 3 | Achievements | 5 |

最佳答案

尝试这样的查询:

select 1 as serial_No, 'Agendas' as Category, count(id) as Counts from agenda_details
union
select 2 as serial_No, 'Publications' as Category, count(id) as Counts from publications
union
select 3 as serial_No, 'Achievements ' as Category, count(id) as Counts from achievements

关于mysql - 我如何在mysql中传输表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51703406/

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