From ecda7954eff878783515fefb0d3281b9a2c6a950 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 31 Mar 2024 16:47:51 +0200 Subject: [PATCH] Query formatting I first thought that ORDER BY time ASC was missing because I didn't see it. --- sn.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sn.go b/sn.go index bae9c01..4a226e6 100644 --- a/sn.go +++ b/sn.go @@ -23,7 +23,8 @@ func CurateContentForStackerNews() (*[]Story, error) { FROM hn_items WHERE rank = 1 AND id NOT IN (SELECT hn_id FROM sn_items) AND length(title) >= 5 GROUP BY id - HAVING unixepoch(end) - unixepoch(start) >= 3600 ORDER BY time ASC + HAVING unixepoch(end) - unixepoch(start) >= 3600 + ORDER BY time ASC LIMIT 1 ) t JOIN hn_items ON t.id = hn_items.id AND t.end = hn_items.created_at; `); err != nil {