I coder for iOS and I use SQLite for my data storage.
For now i have two tables in my database. This is table_1 and table_2 (it's easier for understanding)
About struct:
table_1 contain id field (int type) and some_value field (text type)
table_2 contain id field (int type) and table_1_id field (int type)
My question is next: how to select all row from table_1 via array table_1_id field table_2, and this is must SELECT with ORDER BY. I mean order by array.
For example:
if table_2 -> table_1_id contain value 5, 1, 10, 3, 15, 2
the result of output must be in this order.
For now my query is simple:
SELECT * FROM table_1 WHERE id IN (5, 1, 10, 3, 15, 2)
but the select not return order for this query it return data order by 1, 2, 3, 5, 10, 15.
I think I make relation between my table and make SELECT from table_2 uses ORDER BY, but I don't know how to do this correct.
Thanks in advance!
(Very important for me return this order - 5, 1, 10, 3, 15, 2)