Oracle sql语句转换为Mysql语句 急~~
Oracle :select grbh from com.eway.vo.Zjxx zj where to_char(zj.jbsj,'yyyymm')='"+ sj + "'
其中 sj是字符串参数 现在想把上面的SQL语句转换为Mysql的 主要是时间传入 因为传入的是字符串 200909 而数据库中是 2009-09-31 00:00:00 所以想请教如上在Mysql如何修改~
在线等 急~~
DATE_FORMAT(zj.jbsj,'%Y%m')
SQL code:
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2009-09-09 16:08:42 |
+---------------------+
1 row in set (0.00 sec)
mysql> select date_format(now(),'%Y%m');
+---------------------------+
| date_format(now(),'%Y%m') |
+---------------------------+
| 200909 |
+---------------------------+
1 row in set (0.00 sec)
mysql>
完全等价的写法 date_format 函数 等价于 to_char,src_TO_DATE函数等价于 to_date
select grbh from zj where date_format(zj.jbsj,'%Y%m')='"+ sj + "'
ssql = "select grbh from com.eway.vo.Zjxx zj where date_format(zj.jbsj,'%Y%m')='"+ sj + "'"
SELECT GRBH from FFXX WHERE FFSJ=to_date('"ffsj"','yyyy-mm-dd')";
这个该怎么改呢??谢谢了
SQL code
Code highlighting produced by Actip
相关问答:
大家帮忙看看这2个sql语句哪个查询的速度更快点。谢谢帮忙。比较着急。在做性能测试。
select * from
表A LEFT OUTER JOIN 表B ON (表A.id || ' ' =表B.id) ,表C , 表D, 表E
Where其他条件
select * ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
如题,这三个在win7下使用会有什么兼容性问题吗?
由于我最近在使用win7,就懒得进xp了!
自己用windows 2008有一年多了,没出现任何问题。
win7测试版也用过,不会有什么问题的,放心。
当然你最 ......
我是用mysql自带的C API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))
{
AfxMessageBox("数据库连接失败") ......
我现在学习MYSQL,问下mysql储存过程如何建立和使用,最好写成$sql="sql语句",$re=mysql_query($sql);谢谢
建议你先自己看一下文档中的例子。
http://dev.mysql.com/doc/refman/5.1/zh/stored-pro ......