随笔分类 - mysql
摘要:设想两张表,如下 table A field id field name table B field id filed my_name 现在希望将表B中的my_name中的内容“拷贝”到表A中对应的name字段中,表A中的记录与表B中的记录通过id对应。 首先我们来连表查询一下: SELECT a.
阅读全文
摘要:按年汇总,统计:select sum(mymoney) as totalmoney, count(*) as sheets from mytable group by date_format(col, '%Y');按月汇总,统计: select sum(mymoney) as totalmoney,
阅读全文
摘要:select * from table where field is null
阅读全文
摘要:查询user表中,user_name字段值重复的数据及重复次数
阅读全文