gpt4 book ai didi

mysql - 按列组合 mysql 查询

转载 作者:行者123 更新时间:2023-11-29 12:43:48 25 4
gpt4 key购买 nike

是否有按列组合 mysql 查询的方法?我有以下疑问

select  count(ticket_id) as numInProgress from ost_ticket where status
= 'in progress' and topic_id not in (select topic_id from ost_org_site_map)

select count(ticket_id) as numAssigned from ost_ticket where status =
'open' and topic_id not in (select topic_id from ost_org_site_map)

我正在尝试获取以下格式的结果

---numInProgress | numAssigned---
2 | 8
---------------------------------

最佳答案

只需将它们用作 select 语句中的子查询,例如

SELECT ($statement1$),($statement2$)

或者您的疑问:

SELECT (select count(ticket_id) as numInProgress from ost_ticket where status = 'in progress' and topic_id not in (select topic_id from ost_org_site_map)) as numInProgress ,(select count(ticket_id) as numAssigned from ost_ticket where status = 'open' and topic_id not in (select topic_id from ost_org_site_map)) as numAssigned;

关于mysql - 按列组合 mysql 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25729406/

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