我想按<Select
style={{ width: "50%", marginBottom: "20px" }}
onChange={entry => {
this.setState({ select2: entry });
this.onFilteredChangeCustom(
entry.value,
"firstName"
);
}}
value={this.state.select2}
multi={true}
options={this.state.data.map((o, i) => {
return { id: i, value: o.firstName, label: o.firstName };
})}
/>
来排序帖子列表,并根据活动或过时将其分组。 id_post
,status=1 when active
status=2 when outdated
我尝试使用此mysql代码,但仅显示两个输出。 我在做什么错??
SELECT *,count(id_post) as count
FROM posts
WHERE 1
GROUP BY status
ORDER BY count DESC
预期产量
id_post title status
5 a 1
7 b 2
9 c 1
17 d 2
21 f 1
答案 0 :(得分:0)
根据您的数据,您无需使用GROUP BY
。所以
select *
from posts
order by status ASC, id_post DESC