April 13, 2004 at 5:12 am
select * from employee where emp_id in (select emp_id from authors)
run this query in pubs. I
t will give result of all rows in employee.
Even though it is not having the field emp_id in authors
How the mapping is done between these two tables?
select emp_id from authors
If u run above query. u will get following error
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name 'emp_id'.
Regards,
Sunil
Software Programmer
April 13, 2004 at 6:41 am
it converts it into a correlated subquery
problem ? no problem one just has to know and keep it in mind.
(also take a look at "subquery fundamentals" in BOL )
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
April 14, 2004 at 8:23 am
That's interesting.. I didn't realize SQL Server would interpret things that way either..
If you try:
select * from employee where emp_id in (select authors.emp_id from authors)
you get the expected error.. (invalid column id)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply