oracle积累继续

选出当天的日期的数据

select * from test_table where to_char(datetime, 'yyyy-mm-dd')=to_char(sysdate,'yyyy-mm-dd');

 

要想改变查询的结果,可以用 (case when then else end) as 句式

select (case when to_char(datetime, 'yyyy-mm-dd')=to_char(sysdate,'yyyy-mm-dd') then '今日' else '非今日' end) as datetime, shengfu from test_table;

 

repalce用法

replace(c1, c2, c3)

从c1字符串中找到c2字符,替换成c3字符

 

lpad用法

lpad(c1, length, c3)

返回没有length长,用c3再左边补齐

比length长,从右边截断

 

选两张表,结合

select t1.sname||'_VS_'||t2.sname from qiudui t1, qiudui t2 where t1.sname<>t2.sname;

 

 

 

 

 

 

 

 

 

posted @ 2013-09-03 16:49  holycrap  阅读(168)  评论(0编辑  收藏  举报