August 13, 2013 at 9:34 pm
Comments posted to this topic are about the item Sales puzzle
--------------------------------------
;-)βEverything has beauty, but not everyone sees it.β β Confucius
August 13, 2013 at 11:28 pm
Ah! Very simple question to start the day. Thanks Gary:-)
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
August 13, 2013 at 11:46 pm
Lokesh Vij (8/13/2013)
Ah! Very simple question to start the day. Thanks Gary:-)
+1 π
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
August 14, 2013 at 12:24 am
kapil_kk (8/13/2013)
Lokesh Vij (8/13/2013)
Ah! Very simple question to start the day. Thanks Gary:-)+1 π
+1:-)
Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
August 14, 2013 at 1:31 am
This was removed by the editor as SPAM
August 14, 2013 at 2:36 am
Thanx 4 the easy question π
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
August 14, 2013 at 2:46 am
I have worked with SQL Server on and off for many years, but I don't think I recall ever seeing "ORDER BY [number]" as it appears in this question.
Could some kindly person explain this to me, because a clear explanation seems to be difficult to locate in the documentation, and in searches. This little issue was why I failed this question!
Many thanks
Kenneth Spencer
You never know: reading my book: "All about your computer" might just tell you something you never knew!
lulu.com/kaspencer
August 14, 2013 at 2:54 am
kaspencer (8/14/2013)
I have worked with SQL Server on and off for many years, but I don't think I recall ever seeing "ORDER BY [number]" as it appears in this question.Could some kindly person explain this to me, because a clear explanation seems to be difficult to locate in the documentation, and in searches. This little issue was why I failed this question!
Many thanks
Kenneth Spencer
Order by [some number], this number indicates the order of the column in the Select clause.
Hope that would help you.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
August 14, 2013 at 3:02 am
hany.helmy (8/14/2013)
kaspencer (8/14/2013)
I have worked with SQL Server on and off for many years, but I don't think I recall ever seeing "ORDER BY [number]" as it appears in this question.Could some kindly person explain this to me, because a clear explanation seems to be difficult to locate in the documentation, and in searches. This little issue was why I failed this question!
Many thanks
Kenneth Spencer
Order by [some number], this number indicates the order of the column in the Select clause.
Hope that would help you.
Like for example:
Select EmpId, EmpName, DeptId, DeptName
From SomeTable
Order by 2 -- this indicates that the result set will be sorted by column no. 2 in the Select clause which is 'EmpName'.
Regards,
Hany Helmy
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
August 14, 2013 at 3:03 am
kaspencer (8/14/2013)
I have worked with SQL Server on and off for many years, but I don't think I recall ever seeing "ORDER BY [number]" as it appears in this question.Could some kindly person explain this to me, because a clear explanation seems to be difficult to locate in the documentation, and in searches. This little issue was why I failed this question!
Many thanks
Kenneth Spencer
Hi kenneth,
In Order By we can specify integer representing the position of the column in the select list. The result set will be sorted based on the column. For further details pls refer
http://technet.microsoft.com/en-us/library/ms188385.aspx
Also FYI, Order By has no effect in this question, without sorting also you will get the same result, Its matter of Where clause.
I hope you are aware of Where clause will be applied before Order By.
--
Dineshbabu
Desire to learn new things..
August 14, 2013 at 5:16 am
I use numbers in my order by statements every day for short queries. It is faster than typing out long names and is especially nice when the column is some kind of calculatoni, function or case statement. I would not use them for production systems but for just checking around it my data they have been wonderful
August 14, 2013 at 5:24 am
Dineshbabu (8/14/2013)
kaspencer (8/14/2013)
I have worked with SQL Server on and off for many years, but I don't think I recall ever seeing "ORDER BY [number]" as it appears in this question.Could some kindly person explain this to me, because a clear explanation seems to be difficult to locate in the documentation, and in searches. This little issue was why I failed this question!
Many thanks
Kenneth Spencer
Hi kenneth,
In Order By we can specify integer representing the position of the column in the select list. The result set will be sorted based on the column. For further details pls refer
http://technet.microsoft.com/en-us/library/ms188385.aspx
Also FYI, Order By has no effect in this question, without sorting also you will get the same result, Its matter of Where clause.
I hope you are aware of Where clause will be applied before Order By.
Nice explanation Dinesh π
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
August 14, 2013 at 6:05 am
You know, a simpler question is nice every once in a while. In fact, I found myself studying it to see what I missed. π Thanks.
August 14, 2013 at 6:53 am
tom.w.brannon (8/14/2013)
I use numbers in my order by statements every day for short queries. It is faster than typing out long names and is especially nice when the column is some kind of calculatoni, function or case statement. I would not use them for production systems but for just checking around it my data they have been wonderful
Agree with Tom. We did have this "feature" used in production and it caused issues when an additional column was added to the select causing the "ORDER BY" to bring the records back in an order that was not expected.
However, as Tom mentioned, this is great when doing sub queries, unions or aggregates to do a quick check on the date without having to define aliases or use the calculation in the order by clause.
Anton
August 14, 2013 at 7:05 am
Good question. It's a shame that in my dazed state I knew the right answer, but picked the wrong one. Time to go have some magic caffeinated elixir.
Viewing 15 posts - 1 through 15 (of 32 total)
You must be logged in to reply to this topic. Login to reply