In oracle you can not use order by with union all. They dont work together. In this post i will explain you a work around. We will cheat Oracle :-)
--------------------------
Create Table Foo(
Foo_Id Number,
Foo_Name Varchar2(20)
);
Create Table Bar(
Bar_Id Number,
bar_Name Varchar2(20)
);
Insert Into Foo Values(1, 'Fawad');
Insert Into Foo Values(2, 'Nazir');
Insert Into Bar Values(1, 'Mark');
Insert Into bar Values(2, 'Donald');
--Order by and Union All is not allowed together
Select * From Foo Order By Foo_Id desc
Union All
Select * From Bar Order By Bar_Name
--Work around (Cheating SQL :) )
select * from (Select * From Foo Order By Foo_Id desc) a
Union All
select * from (Select * From Bar Order By Bar_Name) b
Enjoy :-)
Subscribe to:
Post Comments (Atom)
Azure OpenAI Architecture Patterns & Deployment Patterns
Sharing some useful links that will help customers architect Azure OpenAI solution using the best practices: (1) Azure OpenAI Landing Zone r...
-
Setting up a MPI cluster on Ubuntu involves the following steps: 1. Install OpenMPI on all machines. $sudo apt-get install libopenmpi-de...
-
Very Useful Link: http://people.cc.ku.edu/~grobe/intro-to-LSL/index.html#particle Using the Linden Script Language This page is a short...
-
float p_size = 0.1; default { state_entry() { llSay(0, "Hello, Avatar!"); llSetPrimitiveParams( [ PRIM_...
No comments:
Post a Comment