how to order rows in pl/sql?
i have a table of numbers, i want to order in ascending order if id of table is odd and descending if id is even
Jump to Post
You can do that with 2 selects:
For odd ids:
SELECT * FROM table WHERE MOD(ID,2) <> 0 ORDER BY column ASC
For even ids:
SELECT * FROM table WHERE MOD(ID,2) = 0 ORDER BY column DESC
All 5 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.