有这么个 sql 语法吗?
请教:如何把所有文档动态按修改时间从新到旧排列索引到一个文档中?
相关帖子
-
我又修改了下, 可以自定义时间范围的,只需要在开头修改 today 和 next 里的时间就好了,在 data/templates 文件夹新建一个 md 文件,粘贴过去,然后在思源用/斜杆菜单打开模板选择页面选择就好了
sql 我加了 Limit 语句限制查询为 10000 条,好像如果不加只会展示三十几条
块引版本
<!-- 设定时间 --> .action{$today:= toDate "2006-01-02 15:04:05" "2021-08-05 00:00:00"} .action{$next := toDate "2006-01-02 15:04:05" "2021-09-05 00:00:00"} ## .action{$today | date "2006-01-02 Mon"} \~ .action{$next | date "2006-01-02 Mon"} 期间更新的笔记文档 .action{$today:= $today | date "20060102150405"} .action{$next := $next | date "20060102150405"} .action{$blocks :=queryBlocks "SELECT * FROM blocks WHERE id in (SELECT root_id FROM blocks WHERE (updated >= '?' AND updated <= '?' AND root_id != '?')) order by updated DESC Limit 10000 " $today $next .id} .action{range $v := $blocks} - ((.action{$v.RootID} ".action{$v.HPath}")) .action{end}
块超链接版本
<!-- 设定时间 --> .action{$from:= toDate "2006-01-02 15:04:05" "2021-07-05 00:00:00"} .action{$to := toDate "2006-01-02 15:04:05" "2021-09-05 00:00:00"} ## .action{$from | date "2006-01-02 Mon"} \~ .action{$to | date "2006-01-02 Mon"} 期间更新的笔记文档 .action{$today:= $from | date "20060102150405"} .action{$next := $to | date "20060102150405"} .action{$blocks :=queryBlocks "SELECT * FROM blocks WHERE id in (SELECT root_id FROM blocks WHERE (updated >= '?' AND updated <= '?' AND root_id != '?')) order by updated DESC Limit 10000" $today $next .id} .action{range $v := $blocks} - [.action{$v.HPath}](siyuan://block/.action{$v.ID}) .action{end}
1 回复1 操作Achuan-2 在 2021-09-05 20:41:07 更新了该回帖 - 其他回帖
-
块超链接版本
## .action{ now | date "2006-01-02 Mon "} 今天更新的笔记文档 .action{$today := now | date "20060102"} .action{$next := (now | date_modify "+24h")| date "20060102"} .action{$blocks :=queryBlocks "SELECT * FROM blocks WHERE id in (SELECT root_id FROM blocks WHERE (updated >= '?' AND updated <= '?' AND root_id != '?')) order by updated DESC " $today $next .id} .action{range $v := $blocks} - [.action{$v.HPath}](siyuan://block/.action{$v.ID}) .action{end}
1 回复 - 查看全部回帖
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于