mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
chore(SQL): Prepare some queries
This commit is contained in:
parent
ee433e2d82
commit
9e99a86739
1 changed files with 20 additions and 0 deletions
|
@ -29,3 +29,23 @@ CREATE INDEX library_favorite_index ON mangas(favorite) WHERE favorite = 1;
|
|||
findAll:
|
||||
SELECT *
|
||||
FROM mangas;
|
||||
|
||||
getLastRead:
|
||||
SELECT M.*, max(H.history_last_read) AS max
|
||||
FROM mangas AS M
|
||||
JOIN chapters AS C
|
||||
ON M._id = C.manga_id
|
||||
JOIN history AS H
|
||||
ON C._id = H.history_chapter_id
|
||||
WHERE M.favorite = 1
|
||||
GROUP BY M._id
|
||||
ORDER BY max DESC;
|
||||
|
||||
getLastFetched:
|
||||
SELECT M.*, max(C.date_fetch) AS max
|
||||
FROM mangas AS M
|
||||
JOIN chapters AS C
|
||||
ON M._id = C.manga_id
|
||||
WHERE M.favorite = 1
|
||||
GROUP BY M._id
|
||||
ORDER BY max DESC;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue