一。.常用函数
1.IFNULL(expr1,expr2)
如果expr1不是NULL,IFNULL()返回expr1,否则它返回expr2。IFNULL()返回一个数字或字符串值,取决于它被使用的上下文环境。举例如下:
mysql> select IFNULL(1,0);
-> 1 mysql> select IFNULL(0,10); -> 0 mysql> select IFNULL(1/0,10); -> 10 mysql> select IFNULL(1/0,yes);2. IF(expr, v1, v2)
如果expr成立,返回值为v1,否则返回v2mysql> select if(1>2,2,3), -> if(1<2,'yes','no'), -> if(strcmp('test','test1'),'no','yes');+-------------+--------------------+---------------------------------------+| if(1>2,2,3) | if(1<2,'yes','no') | if(strcmp('test','test1'),'no','yes') |+-------------+--------------------+---------------------------------------+| 3 | yes | no | +-------------+--------------------+---------------------------------------+ 1 row in set (0.00 sec)
3.java中怎么给Mysql传参
String QUERY_SQL = "select plat_id,appkey,income from external_dataexternal_api_data where dayid='"+DateUtils.str2Date(target_time)+"'";