--以column1排序进行查询,也可以以多个字段进行排序,如order by column1,column2,默认是升序,降序用desc select * from table where column>1 order by column1 --把查询结果放到临时表temptable中 select column1 from table where colunm2<2 into temp temptable --把字段column1放到变量var中 select colunm1 into var from table --过滤出column2字段有两条以上的记录 select column2,count(*) from table group by 1 having count(*)>1 --排除重复的行 select distinct column1 from table select unique column1 from table --时间函数 select day(time_stamp) from table 返回日期中的天 select day(current) from table
----与时间有关----
day(current)表示当天(只列出天数) year(current)显示年份 month(current)显示月份 date(current)显示当天(年月日) weekday(current)显示星期几 --此处的current可用today代替,如year(today) select current year to day from table current year to month 显示年月 current year to day 显示年月日 current year to hour显示年月日小时 current year to minute显示年月日小时分 current year to second 显示年月日小时分秒 限制时间,显示年到秒 --extend(time_stamp,year to second) 限制时间,显示年到月