感謝分享:https://www.cnblogs.com/skyEva/p/7804589.html
right JOIN test.dim_month_date p2
on p1.month=p2.y_month and p1.day<=p2.day
可以改寫成
right JOIN test.dim_month_date_zyy p2
on p1.month=p2.y_month
where p1.day<=p2.day
當然此時要注意 null 引起的記錄數不一致。
感謝分享:https://www.cnblogs.com/skyEva/p/7804589.html