I have a SQLite Database and I need to join two tables together and output the combined one in random order.
and the database is like this
I'm new to SQLite and after searching and reading tutor, I use the following command:
SELECT Column1 AS Eng,Column2 AS Chn
FROM list1
UNION
SELECT Column1 AS Eng,Column2 AS Chn
FROM list2
ORDER BY Eng RANDOM()
But the output is
sqlite3.OperationalError: near "RANDOM": syntax error
However if I drop RANDOM() function it turns out to be nothing wrong except no random output
SELECT Column1 AS Eng,Column2 AS Chn
FROM list1
UNION
SELECT Column1 AS Eng,Column2 AS Chn
FROM list2
ORDER BY Eng
I followed the instructions here Select random row(s) in SQLite and here Selecting a Random Row from an SQLite Table
Thank you!
Aucun commentaire:
Enregistrer un commentaire