日期:2014-05-17  浏览次数:20726 次

求大神。指点、
select x.* from (Select rownum rowno, z.* from ( 
select a.zhongduanid,
  b.addressname,
  c.display_name as zhongduanxinhao,
  a.zhongduanbianhao,
  a.simkahao,
  a.dengjiriqi,
  a.youxiaoriqi,
  decode(a.zhuangtai, 0, '停用', '正常') as zhuangtai,
  a.zuihouxiugaishijian,
  a.banbenhao
  from t_zhongduan a
  left join t_address b
  on a.quhuaid = b.addressid
  left join mansys.t_dict_item c on a.zhongduanxinghaodm=CAST(c.fact_value as char(3))
  where 1 = 1 and dict_code='dm_xb'


这是我的SQL语句,数据库表里面有个字段 dengjiriqi ,现在我想查的是 dengjiriqi,与服务器上的时间一样的数据。在SQL语句上该怎么改。

------解决方案--------------------
SQL code

select sysdate
from dual

------解决方案--------------------
如果a.dengjiriqi是日期类型的可以直接a.dengjiriqi=sysdate,如果a.dengjiriqi是其他类型的,就要进行类型转换了
------解决方案--------------------
SQL code


select to_char(sysdate,'yyyy-mm-dd') c1,
       to_char(sysdate,'yyyymmdd') c2
from dual

       c1        c2
------------------------------------
1    2012-05-23    20120523

------解决方案--------------------
sysdate就是当前系统时间,你可以用(select sysdate from dual)这条语句看到下面的内容:

SQL> select sysdate from dual;

SYSDATE
---------
23-MAY-12