Sort Result without using of "Order By" clause

Hi Friends , 

This is a Example of Sort Result without using of "Order By" clause.

 --Create
Sample Table

CREATE TABLE [dbo].[tblEMployee](

[EmpID] [int] IDENTITY(1,1) NOT NULL,

[EmpCode] [int] NULL,

[EmpName] [varchar](100)

) ON [PRIMARY]




 Inset
The Data


Insert Into tblEmployee Values(1,'Employee1')

Insert Into tblEmployee Values(3,'Employee3')

Insert Into tblEmployee Values(2,'Employee2')

Insert Into tblEmployee Values(5,'Employee5')

Insert Into tblEmployee Values(6,'Employee6')

Insert Into tblEmployee Values(4,'Employee4')

Insert Into tblEmployee Values(9,'Employee9')

Insert Into tblEmployee Values(7,'Employee7')

Insert Into tblEmployee Values(8,'Employee8')

Insert Into tblEmployee Values(8,'Employee9')

Insert Into tblEmployee Values(8,'Employee10')

Insert Into tblEmployee Values(8,'Employee11')



 Query Sort Result without using of "order by" clause

Select Distinct E2.EmpID,E2.EmpCode,E2.EmpName from tblEmployee as E1,tblEmployee as E2 Where E1.EmpCode>=E2.EmpCode



1.png

Ebook Download
View all
Learn
View all