January 29, 2010 at 5:17 am
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..?
January 29, 2010 at 8:17 am
You're basically doing an inner join between <Student> and <School> on ID columns. Are IDs unique across these two tables?
_____________________________________________________________________
- Nate
January 30, 2010 at 5:07 am
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
January 30, 2010 at 5:14 am
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, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply