Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
T-SQL
»
using outer query column name in subquery...
using outer query column name in subquery while doing order by
Rate Topic
Display Mode
Topic Options
Author
Message
ganaparthi.jagadeesh
ganaparthi.jagadeesh
Posted Friday, January 29, 2010 5:17 AM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, April 18, 2012 4:04 AM
Points: 76,
Visits: 36
using outer query column name in subquery while doing order by caluse
ex: Select name,id,school from <Student>
where id in
(select top 5 id from <Somtable> order by school)
school name is not present in <Sometable>
will it work...i experinced this type situation.
it has worked.
can any one give reasons..how it is working..?
Post #855974
RP_DBA
RP_DBA
Posted Friday, January 29, 2010 8:17 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 12:31 PM
Points: 580,
Visits: 814
You're basically doing an inner join between <Student> and <School> on ID columns. Are IDs unique across these two tables?
_____________________________________________________________________
- Nate
@nate_hughes
Post #856122
ganaparthi.jagadeesh
ganaparthi.jagadeesh
Posted Saturday, January 30, 2010 5:07 AM
SSC Journeyman
Group: General Forum Members
Last Login: Wednesday, April 18, 2012 4:04 AM
Points: 76,
Visits: 36
Some ids of student table will present in school table...i am not dding inner join..if i go for inner join..will get all rows which were common based on id
Post #856628
GilaMonster
GilaMonster
Posted Saturday, January 30, 2010 5:14 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:56 AM
Points: 37,734,
Visits: 30,003
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #856632
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.