October 8, 2008 at 8:00 am
Why is it necessary to sometimes include multiple tables in our SELECT queries?
October 8, 2008 at 8:07 am
Because the data that your require is located in seperate tables. So you join them together using primary keys and foreign keys to select the information you need.
October 8, 2008 at 8:15 am
Because sometimes the data you want does not lie in just one table and you have to query all the required tables at the same time in order to get the right data the right way.
oops, I guess I should have refreshed the web page before posting. I didn't notice that Steve had already answered.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
October 8, 2008 at 8:59 am
an example would be something like this
table1(iUserID, FirstName, LastName)
1,Jon,Smith
2,Jim,Smith
table2(iUserID,Address)
1,1234 Mocking bird ln
2,2345 Baltic ave
if you want to 'link' the two tables together to see who has what address
select t1.FirstName, t1.LastName, t2.Address
from table1 t1
inner join table2 t2 on t1.iUserID = t2.iUserID
and you get
Jon Smith 1234 Mocking bird ln
Jim Smith 2345 Baltic ave
as a result
October 8, 2008 at 9:02 am
Thanks Steve for taking out the time to reply to my post.
October 8, 2008 at 9:03 am
Thanks Alvin for the reply.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply