mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
docs(sql): Documentate this insanity of a query [skip ci]
This commit is contained in:
parent
160a7109da
commit
1cb635999e
1 changed files with 4 additions and 4 deletions
|
@ -110,14 +110,14 @@ ORDER BY max_last_read.history_last_read DESC
|
||||||
LIMIT :limit OFFSET :offset;
|
LIMIT :limit OFFSET :offset;
|
||||||
|
|
||||||
getRecentsAll:
|
getRecentsAll:
|
||||||
SELECT
|
SELECT -- Recently read manga
|
||||||
M.*,
|
M.*,
|
||||||
C.*,
|
C.*,
|
||||||
history.history_id AS history_id,
|
history.history_id AS history_id,
|
||||||
history.history_chapter_id AS history_chapter_id,
|
history.history_chapter_id AS history_chapter_id,
|
||||||
history.history_last_read AS history_last_read,
|
history.history_last_read AS history_last_read,
|
||||||
history.history_time_read AS history_time_read
|
history.history_time_read AS history_time_read
|
||||||
FROM (
|
FROM ( -- Check if there's any unread chapters and whether to include read chapters
|
||||||
SELECT M2.*
|
SELECT M2.*
|
||||||
FROM mangas AS M2
|
FROM mangas AS M2
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
|
@ -145,7 +145,7 @@ JOIN (
|
||||||
FROM chapters AS C2 JOIN history AS H2
|
FROM chapters AS C2 JOIN history AS H2
|
||||||
ON C2._id = H2.history_chapter_id
|
ON C2._id = H2.history_chapter_id
|
||||||
GROUP BY C2.manga_id
|
GROUP BY C2.manga_id
|
||||||
) AS max_last_read
|
) AS max_last_read -- Most recent chapters
|
||||||
ON C.manga_id = max_last_read.manga_id
|
ON C.manga_id = max_last_read.manga_id
|
||||||
AND max_last_read.history_chapter_id = history.history_chapter_id
|
AND max_last_read.history_chapter_id = history.history_chapter_id
|
||||||
AND max_last_read.history_last_read > 0
|
AND max_last_read.history_last_read > 0
|
||||||
|
@ -157,7 +157,7 @@ AND (
|
||||||
:apply_filter = 0 OR S.name IS NULL
|
:apply_filter = 0 OR S.name IS NULL
|
||||||
)
|
)
|
||||||
|
|
||||||
UNION -- Newly added chapter
|
UNION -- Newly fetched chapter
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
M.*,
|
M.*,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue