我想做一个查询,计算我表中的所有“电子邮件”行,并根据频率返回所有值。我不想对结果进行分组,我想显示结果的每一个变化,这是我目前所拥有的,你可以看到它按频率排序,但按组合并,我只想显示它们都按频率顺序排列。
select email
from uploads
group by email
order by count(*) desc
SQL -
CREATE TABLE uploads
(
email varchar(200)
);
INSERT INTO uploads
(email)
VALUES
('test@email.com'),
('test@email.com'),
('test@email.com'),
('test2@email.com'),
('test2@email.com'),
('test3@email.com'),
('test4@email.com');
这是我想要的结果
| EMAIL |
----------------------
| test@email.com |
| test@email.com |
| test@email.com |
| test2@email.com |
| test2@email.com |
| test3@email.com |
| test4@email.com |