B V, Phanisekhar <[EMAIL PROTECTED]> wrote:
Assume the database given below

mainTable (rowid INTEGER, puid INTEGER)

Assume main table be

Rowid Puid
1                     2
2                     3
3                     4
4                     6
5                     7
6                     8

"select  rowid from mainTable where Puid = 2 OR puid = 8 OR puid = 7
OR puid = 3"

Will the result of the above query be (1, 6, 5, 2) or (1, 2, 5, 6)?

Why don't you try it and see for yourself?

Note that, without ORDER BY clause, the order of records is an implementation detail you should not rely on. It may be (1, 6, 5, 2), or (1, 2, 5, 6), or something else. If you want a particular order, specify it explicitly.

Using which query we can get the result (1, 6, 5, 2)?

select  rowid from mainTable where Puid in (2, 8, 7, 3)
order by (case Puid when 2 then 1 when 8 then 2 when 7 then 3 when 3 then 4 end);

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to