您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

MySQL的一些技巧_MySQL

2024/3/31 18:45:46发布15次查看
使用rand()获取随机结果
在order by语句中可按照如下的随机顺序检索数据行:
mysql> select * from tbl_name order by rand();
order by rand()同 limit 的结合从一组列中选择随机样本很有用:
mysql> select * from table1, table2 where a=b and c    -> order by rand() limit 1000;
group by列别名
数据表没有day字段(date型),只有ctime字段(datetime型),但需要按天进行汇总统计:
mysql> select date(ctime) as day, count(*) from league_apply where ctime >= '2011-02-15' and ctime
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product