SQLite Forum

Heading Row Repeat
Login

Heading Row Repeat

(1) By anonymous on 2021-09-30 11:42:30

Imagine a table contains a multi-column report which is read in batches of 64 records with the first row being a record having the same number of columns coming from another table.

I tried the following SQL; for simplicity, I am using the first row comes from the same table.

<code>
SELECT *
FROM sales limit 1 offset 0
UNION
SELECT *
FROM sales limit 64 offset 1;
</code>
 
returns

> Error: LIMIT clause should come after UNION NOT before 

- Is the error referring to the statement above UNION or to the one below?
- Looking for a quick way to refactor my SQL. Ideas?

(2) By anonymous on 2021-09-30 13:07:25 in reply to 1 [link]

`SELECT * from (select * FROM sales limit 1 offset 0)
UNION
SELECT * from (select * FROM sales limit 64 offset 1);`