摘要:
1.第一种 select 表名.*, ROUND(DATEDIFF(CURDATE(), birthday)/365.2422) as age from userinfo 其中DATEDIFF() 函数用来计算两个参数间的相差天数 CURDATE()是返回“YY-MM-DD”格式的当前日期 birt 阅读全文
摘要:
mysql中查看一个字段中,有几个逗号 利用replace、length的内置函数 SELECT dept_name,ancestors,LENGTH(ancestors)-LENGTH(replace(ancestors,',',''))+1 as count FROM sys_dept 阅读全文