gpt4 book ai didi

mysql - 来自同一个表的多个 COUNT SELECTS

转载 作者:行者123 更新时间:2023-12-01 00:38:28 25 4
gpt4 key购买 nike

如何在同一个表中执行多个 COUNT(*) SELECTS ...

$query = "SELECT count(*) FROM content_form WHERE read_flag = 0 ";  
$query = "SELECT count(*) FROM content_form WHERE read_flag = 1 ";
$query = "SELECT count(*) FROM content_form WHERE read_flag = 0 ";

最佳答案

试试这个

SELECT read_flag,count(read_flag) as cnt FROM content_form WHERE read_flag IN (0,1,....) GROUP BY read_flag

关于mysql - 来自同一个表的多个 COUNT SELECTS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40929616/

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