inloop / sqlite-viewer

View SQLite file online
http://inloop.github.io/sqlite-viewer
Apache License 2.0
861 stars 324 forks source link

Cannot paginate SQL query with sub-SELECT. #36

Open MikuAuahDark opened 5 months ago

MikuAuahDark commented 5 months ago

Consider this query:

SELECT * FROM foo WHERE bar_id IN (SELECT id FROM bar) LIMIT 0,30

The paginator will try to find the count by running SELECT COUNT(*) AS count FROM bar). Note the trailing closing parenthesis and the wrong table. This result in the pagination no longer works due to SQL syntax error.