SQL
Holo_Sai5420
这个作者很懒,什么都没留下…
展开
-
两表连接去重复
SELECT a.name ,a.id,b.province FROM (SELECT NAME,id FROM t_area WHERE parent_id =0) aLEFT JOIN (SELECT DISTINCT province FROM t_carbon_area WHERE deleted = 0 UNIONSELECT DISTINCT province FROM t_c...原创 2018-05-30 15:50:03 · 554 阅读 · 0 评论 -
sql 关键字转义
`delete from fd_shop_rank where \`year_month\` = '${ym1}'`原创 2018-07-17 16:27:02 · 3018 阅读 · 0 评论 -
sql save or update
insert into table_name ( col1, col2, col3 ) values ( #{field1}, #{field2}, #{field3} ) on duplicate key update col1 = #{field1}, col2 = #{field2}, col3 = #{field3}原创 2018-07-17 16:28:52 · 790 阅读 · 0 评论 -
MySql实现rownum排序
select @rownum:=@rownum+1 AS rownum,id,dates from `data`,(SELECT @rownum:=0) r ORDER BY dates;原创 2018-07-17 16:30:36 · 931 阅读 · 0 评论