Say I have a table 'alphabet'. This is just a basic representation/example.
id word 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i 10 j 11 k 12 l 13 m
Now assume I am restricted to just a single query (with subqueries) due to a language restriction or otherwise.
I want my 'result' to be as follows:
row col1 col2 col3 1 a b c 2 d e f 3 g h i 4 j k l 5 m
Now I've gotten somewhat close to this by emulating a Full Outer Join in MySQL by following the instructions found here: Full Outer Join in MySQL combined with a sub-query on the same table using something along the lines of:
SELECT
id
,word
FROM table
WHERE MOD(id,3)=1
This isn't particularly perfect, as it requires me to assume that the ids follow each-other perfectly sequentially, but I haven't been able to think of a better method at the time. Since last I recall, LIMIT and OFFSET do not take sub-queries.
However, following this thought through, results into something along the lines of:
row col1 col2 col3 1 a 2 d 3 g 4 j 5 m 6 b 7 e 8 h 9 k 10 c 11 f 12 i 13 l 13 m
Is there a way to get my desired format? And note that normally, the desired way to do this is indeed to just do three calls with a limit-offset call based on a count(). But /is this possible/ to be done in a single call?