Chinaunix首页 | 论坛 | 博客
  • 博客访问: 90976762
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: DB2/Informix

2008-03-24 21:23:19

----select语句总结----

--以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)
限制时间,显示年到月
阅读(724) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~