Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««45678

T SQL Expand / Collapse
Author
Message
Posted Friday, May 29, 2009 10:26 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, April 18, 2014 11:23 AM
Points: 2,319, Visits: 118
The problem is that the order by clause was left out on the initail page.

Today's Question:


What is the output for the query below?

CREATE TABLE E (eid int, mid int, en char(10) )
INSERT E SELECT 1,2,'Vyas'
INSERT E SELECT 2,3,'Mohan'
INSERT E SELECT 3,NULL,'Shobha'
INSERT E SELECT 4,2,'Shridhar'
INSERT E SELECT 5,2,'Sourabh'
SELECT t1.en [Em], t2.en [Ma] FROM E t1, E t2 WHERE t1.mid = t2.eid

when you click the "Click Here" the question has an additional line with the order by clasue

CREATE TABLE E (eid int, mid int, en char(10) )
INSERT E SELECT 1,2,'Vyas'
INSERT E SELECT 2,3,'Mohan'
INSERT E SELECT 3,NULL,'Shobha'
INSERT E SELECT 4,2,'Shridhar'
INSERT E SELECT 5,2,'Sourabh'


SELECT t1.en [Em], t2.en [Ma] FROM E t1, E t2 WHERE t1.mid = t2.eid

order by t1.en
Post #725937
Posted Friday, May 29, 2009 10:50 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 6:29 PM
Points: 32,834, Visits: 14,975
The question was edited to include an ORDER BY. Questions get edited if mistakes are found.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #725952
Posted Monday, June 01, 2009 4:31 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, July 23, 2013 6:34 AM
Points: 654, Visits: 265
easy one! option 1 is the only answer that satisfies the ORDER BY!
Post #726517
Posted Tuesday, June 02, 2009 5:15 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, June 12, 2009 2:17 AM
Points: 42, Visits: 28
Was the typo intentional? I know Attention to detail is important for the DBA - but intentional typo's are bad form.
Post #727312
« Prev Topic | Next Topic »

Add to briefcase «««45678

Permissions Expand / Collapse