文档归类:数据库
mysql清除注释SELECT
concat(
'alter table ',
table_schema,
'.',
table_name,
' modify column ',
column_name,
' ',
column_type,
' ',
IF (
is_nullable = 'YES',
IF (
data_type IN ('timestamp'),
' null ',
' '
),
'not null '
),
IF (
column_default IS NULL,
'',
IF (
data_type IN ('char', 'varchar')
OR data_type IN ('date', 'datetime')
AND column_def...
持之以恒,坚持读完»
表中type是多选字段的值ID用逗号分隔,SELECT * from demo where FIND_IN_SET('3',type);FIND_IN_SET(str,strlist)函数 str :待查询的字符串 strlist :待查找的字段名,字段的值以”,”分隔( 只识别英文逗号 ),如 (1,2,3,5,7)
查询字段(strlist)中包含(str)的结果,返回结果为null或记录。 like是广泛的模糊匹配,字符串中没有分隔符,Find_IN_SET 是精确匹配,字段值以英文","分隔,Find_IN_SET查询的结果要小于like查询的结果。重点来了:SELECT * FROM demo where CONCAT (',' ,type, ',') REGEXP ',(5|7|9),' ;
|( or )表示匹配其中之一,与select语句中的or语句,多个or条件可并入单个正则表达式使用正则表达式查询多个值...
抓住机会,赶紧看完»
INSERT INTO tqk_finance (id, add_time, price, `status`, backcash, uid, income, mark, phone, `client`, ids)
SELECT null, DATE_FORMAT(NOW(),'%Y-%m-%d'), SUM(list.pub_share_pre_fee), 2, 0, 0, SUM(list.user_rate), list.tk_earning_time, list.relation_id, 'app', GROUP_CONCAT(id)
FROM (SELECT id,relation_id,DATE_FORMAT(tk_earning_time, '%Y-%m') as tk_earning_time,tk_status,pub_share_pre_fee,alimama_share_fee,user_rate FROM `tqk_order_app`
where `tk_status` = 3 an...
此文只应天上有,仰望去»