需要查两个表之间的差集 首先,想到的是主键直接not in select mailbox_id from co_user where mailbox_id not in (select mailbox_id from core_mailbox); 好吧!这个是可以,但是数据多了的话,想到这个查询的逻辑有点受不住 于是再改为下面的这样: select cu.mailbox_id,cm.mailbox_id from co_user as cu left join core_mailbox as c…
set @i = -1; set @sql = repeat(" select 1 union all",-datediff('2021-01-01','2030-12-31')+1); set @sql = left(@sql,length(@sql)-length(" union all")); set @sql = concat("select date_add('2021-01-01',interval @i:=@i+1 day) as date…