K
K
khodos_dmitry2020-04-22 12:03:59
SQL
khodos_dmitry, 2020-04-22 12:03:59

Why does the query select everything from the database and not 20 records?

SELECT `chapter`.`id`, `chapter`.`slug` as chapter_slug, `manga`.`slug` as manga_slug, `manga_id` 
FROM `chapter` JOIN `manga` ON `chapter`.`manga_id` = `manga`.`id` 
WHERE `chapter`.`id` IN 
(SELECT * FROM (SELECT `chapter_id` 
 FROM `page` 
 WHERE `compress` = 0 
 GROUP BY `chapter_id` 
 ORDER BY CAST(`page`.`filesize` AS INTEGER) DESC LIMIT 20) t1)

Selects all entries. Why?
SELECT * FROM (SELECT `chapter_id` 
 FROM `page` 
 WHERE `compress` = 0 
 GROUP BY `chapter_id` 
 ORDER BY CAST(`page`.`filesize` AS INTEGER) DESC LIMIT 20) t1

Selects 20 pieces.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question