I was wondering if there is a way to get rows ordered NOT by a column in the table(so no simple option to use ORDER BY or something like that).
I tried both
SELECT *
FROM table
WHERE column IN ('A', 'B', 'C')
and
SELECT *
FROM table
WHERE column = 'A' OR column = 'B' OR column = 'C'
Then, the SqlDataReader in my C# application shows the rows in order like 'C', 'A', 'B' which is (probably) in sequence of the date written in the database.
What I meant is not an alphabetical order but the order the each variable itself shows in the query.
It isn't easy for me to search for the syntax in detail as a beginner of SQL Server. Also, I'm quite new here stack overflow, so let me know if I'm making any mistake. I would appreciate it if you do.
Thank you in advance.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
My bad. The given example was kind of ambiguous. Let me provide a clearer one.
SELECT *
FROM table
WHERE column IN ('r2', 'r4', 'r3', 'r1')
And I want my SqlDataReader object to read 'r2' first, 'r4' next, 'r3' and then 'r1'.
The application used to do it by querying for each single row using a loop and I was afraid that would harm the performance.