Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
Can the Query Output Be Sorted by Multiple Columns in MS SQL Server?
Submitted by: AdministratorYou can specifying multiple columns in the ORDER BY clause as shown in the following example statement, which returns rows sorted by "tag" and "counts" values:
SELECT tag, counts, url, created
FROM ggl_links ORDER BY tag, counts
GO
<pre>
tab counts url created
DBA 390 www.mysql.com 2006-01-01
DBA 960 www.oracle.com 2005-01-01
DBA 972 globalguideline.com 2007-05-19
DEV 120 globalguideline.com/xml 2006-04-30
DEV 439 www.php.net 2004-01-01
SQA 728 globalguideline.com/sql 2007-05-19
SQA 828 www.winrunner.com 2003-01-01
</pre>
Submitted by: Administrator
SELECT tag, counts, url, created
FROM ggl_links ORDER BY tag, counts
GO
<pre>
tab counts url created
DBA 390 www.mysql.com 2006-01-01
DBA 960 www.oracle.com 2005-01-01
DBA 972 globalguideline.com 2007-05-19
DEV 120 globalguideline.com/xml 2006-04-30
DEV 439 www.php.net 2004-01-01
SQA 728 globalguideline.com/sql 2007-05-19
SQA 828 www.winrunner.com 2003-01-01
</pre>
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.