Q: Sql Select 0 1 0 1 sequence from database table I need to fetch output from given below table in 
0 
1
0
1 
sequence .All other data at the end of table.
create table #Temp
(
    EventID INT IDENTITY(1, 1) primary key ,
    Value bit
)
INSERT  INTO  #Temp(Value) Values
(0),(1)
,(0),(0)
,(0),(0)
,(0),(0)
,(1),(1)
,(1),(1)
,(1),(0)
,(0),(0)
,(1),(1)
,(0),(1)


A: This is probably what you want:
select *
from #Temp
order by row_number() over (partition by Value order by EventID), Value

