Default Select Order
Posted in 2003
Topics: SQL Development & Query Writing
This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C3C54B.0BBDC0F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit BlankHi All, I have a Select * from <tab> where <col> = "some condition" Can i know wat is the default order in which the rows are returned... Does it return the rows in the order in which they were inserted.. I need this because now i am joining this to another table & i need to get the records in the same order in which they are returned using the single query... Please Advice... Regards, Vijay Kumar.R Software Engg. HP-ISO Bangalore, Ph : 205 2640 ------=_NextPart_000_0001_01C3C54B.0BBDC0F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <TITLE id=3DridTitle>Blank</TITLE> <STYLE>BODY { MARGIN-TOP: 25px; FONT-SIZE: 10pt; MARGIN-LEFT: 25px; COLOR: #000000; = FONT-FAMILY: Arial, Helvetica; BACKGROUND-COLOR: #ffffff } P.msoNormal { MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-LEFT: 0px; COLOR: #ffffcc; = FONT-FAMILY: Helvetica, "Times New Roman" } LI.msoNormal { MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-LEFT: 0px; COLOR: #ffffcc; = FONT-FAMILY: Helvetica, "Times New Roman" } </STYLE> <META content=3D"MSHTML 6.00.2722.900" name=3DGENERATOR></HEAD> <BODY id=3DridBody style=3D"BACKGROUND-COLOR: #ffffff" bgColor=3D#ffffff = background=3D""> <DIV><SPAN class=3D906420704-18122003>Hi All,</SPAN></DIV> <DIV><SPAN class=3D906420704-18122003></SPAN> </DIV> <DIV><SPAN class=3D906420704-18122003> I have a Select = * from=20 <tab> where <col> =3D "some condition"</SPAN></DIV> <DIV><SPAN class=3D906420704-18122003></SPAN> </DIV> <DIV><SPAN class=3D906420704-18122003> Can i know wat = is the=20 default order in which the rows are returned... Does it return the rows = in the=20 order in which they were inserted.. I need this because now i am joining = this to=20 another table & i need to get the records in the same order in which = they=20 are returned using the single query... Please = Advice...</SPAN></DIV> <DIV><SPAN class=3D906420704-18122003> </SPAN></DIV> <DIV><FONT face=3D"Comic Sans MS" color=3D#808000>Regards,</FONT></DIV> <DIV><FONT face=3D"Comic Sans MS" color=3D#808000>Vijay = Kumar.R</FONT></DIV> <DIV><FONT face=3D"Comic Sans MS" color=3D#808000>Software = Engg.</FONT></DIV> <DIV><FONT face=3D"Comic Sans MS" color=3D#808000>HP-ISO = Bangalore,</FONT></DIV> <DIV><FONT face=3D"Comic Sans MS" color=3D#808000>Ph : 205 = 2640</FONT></DIV> <P> </P></BODY></HTML> ------=_NextPart_000_0001_01C3C54B.0BBDC0F0-- sending to informix-list
Vijay wrote: > This is a multi-part message in MIME format. > > ------=_NextPart_000_0001_01C3C54B.0BBDC0F0 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: 7bit > > BlankHi All, > > I have a Select * from <tab> where <col> = "some condition" > > Can i know wat is the default order in which the rows are returned... > Does it return the rows in the order in which they were inserted.. I need > this because now i am joining this to another table & i need to get the > records in the same order in which they are returned using the single > query... Please Advice... > > Regards, > Vijay Kumar.R > Software Engg. > HP-ISO Bangalore, > Ph : 205 2640 > > As per SQL definitions: if you don't have "order by" in your select rows can be returned in any order and not neccessarily in the same order if you execute the same select twice. That's the rule. If a particular instance returns rows is certain order you were just lucky/unlucky. HTH Michael