Fix missing condition on getLibrary
sql query (#8006)
This commit is contained in:
parent
6865c21c75
commit
48d3d454c0
@ -75,21 +75,22 @@ GROUP BY source;
|
|||||||
getLibrary:
|
getLibrary:
|
||||||
SELECT M.*, COALESCE(MC.category_id, 0) AS category
|
SELECT M.*, COALESCE(MC.category_id, 0) AS category
|
||||||
FROM (
|
FROM (
|
||||||
SELECT mangas.*, COALESCE(C.unreadCount, 0) AS unread_count, COALESCE(R.readCount, 0) AS read_count
|
SELECT mangas.*, COALESCE(UR.unreadCount, 0) AS unread_count, COALESCE(R.readCount, 0) AS read_count
|
||||||
FROM mangas
|
FROM mangas
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT chapters.manga_id, COUNT(*) AS unreadCount
|
SELECT chapters.manga_id, COUNT(*) AS unreadCount
|
||||||
FROM chapters
|
FROM chapters
|
||||||
WHERE chapters.read = 0
|
WHERE chapters.read = 0
|
||||||
GROUP BY chapters.manga_id
|
GROUP BY chapters.manga_id
|
||||||
) AS C
|
) AS UR
|
||||||
ON mangas._id = C.manga_id
|
ON mangas._id = UR.manga_id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT chapters.manga_id, COUNT(*) AS readCount
|
SELECT chapters.manga_id, COUNT(*) AS readCount
|
||||||
FROM chapters
|
FROM chapters
|
||||||
WHERE chapters.read = 1
|
WHERE chapters.read = 1
|
||||||
GROUP BY chapters.manga_id
|
GROUP BY chapters.manga_id
|
||||||
) AS R
|
) AS R
|
||||||
|
ON mangas._id = R.manga_id
|
||||||
WHERE mangas.favorite = 1
|
WHERE mangas.favorite = 1
|
||||||
GROUP BY mangas._id
|
GROUP BY mangas._id
|
||||||
ORDER BY mangas.title
|
ORDER BY mangas.title
|
||||||
|
Loading…
Reference in New Issue
Block a user