gpt4 book ai didi

mysql - 如何从查询中获取 TOP?

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

<分区>

SELECT
user_id,
count(*) total,
sum(case when type = 'yes' then 1 else 0 end) as type_1,
sum(case when type = 'no' then 1 else 0 end) as type_2
FROM history
GROUP by user_id

如何从此查询中获取具有最大计数 type = 'yes'TOP 100 行?

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