建立table表:
插入如下数据:
ID FQQ FTime
1 372647693 2100-11-11
2 372647693 2100-11-11
1 372647694 2100-11-12
2 37264764 2100-11-15
查询如下:
查询结果:
退化为:
641009005 FQQ FTime
641009005 37264764 2100-11-15
641009005 372647693 2100-11-11
641009005 372647694 2100-11-12
CREATE TABLE `table` (
`ID` tinyint(4) NOT NULL,
`FQQ` varchar(12) NOT NULL,
`FTime` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
`ID` tinyint(4) NOT NULL,
`FQQ` varchar(12) NOT NULL,
`FTime` varchar(21) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
插入如下数据:
ID FQQ FTime
1 372647693 2100-11-11
2 372647693 2100-11-11
1 372647694 2100-11-12
2 37264764 2100-11-15
查询如下:
SELECT * , count( DISTINCT FQQ )
FROM `table`
GROUP BY FQQ
LIMIT 0 , 30
FROM `table`
GROUP BY FQQ
LIMIT 0 , 30
查询结果:
ID FQQ FTime count(distinct FQQ)
2 37264764 2100-11-15 1
1 372647693 2100-11-11 1
1 372647694 2100-11-12 1
2 37264764 2100-11-15 1
1 372647693 2100-11-11 1
1 372647694 2100-11-12 1
退化为:
SELECT 641009005 , FQQ, FTime
FROM `table`
GROUP BY FQQ
LIMIT 0 , 30
FROM `table`
GROUP BY FQQ
LIMIT 0 , 30
641009005 FQQ FTime
641009005 37264764 2100-11-15
641009005 372647693 2100-11-11
641009005 372647694 2100-11-12
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3651/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2010-10-19 10:53
评论列表