且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

选择缺失的行并按日期分组(对数据库具有只读访问权限)

更新时间:2022-11-24 20:39:33

SQL 真的不是为这种工作制作的 :/

这是可能的,但真的很麻烦,我强烈不鼓励您这样做.

That's possible but really really messy and I strongly discourage you from doing it.

最简单的方法是拥有一个单独的日历表,但正如您所说,您只有对数据库的读取权限.

The easiest way was to have a separate calendar table but as you said you only have a read access to your database.

另一种是使用这种技巧生成序列:

The other one is to generate the sequence using this kind of trick:

SELECT @rownum:=@rownum+1 rownum, t.*FROM (SELECT @rownum:=0) r, ("yourquery") t;

我不会进入它,正如我已经告诉过你的那样,它真的很丑:(

I won't get into it, as I already told you, it's really ugly :(