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)
Using Handlebar Prompt in Semantic Kernal
> dotnet add package Microsoft.SemanticKernel.PromptTemplates.Handlebars --version 1.30.0 using Microsoft . SemanticKernel ; using Micr...
-
LINK: http://www.techonthenet.com/oracle/functions/nvl.php Oracle/PLSQL: NVL Function In Oracle/PLSQL, the NVL function l...
-
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...
No comments:
Post a Comment