June 24, 2008 at 2:40 am
Hi,
I have three tables
T1 has the columns Course, Site and Roomid.
T2 that has the same columns.
T3 that has columns RoomId and Room Name
I want to populate T2 with the values from T1 . For the Course and the Site the values can be automatically populated by using a Select and Insert statement. But the Roomid column in T2 should have the RoomName column data from T3.
(Eg : T2. Roomid= T3.Roomname where T1.Roomid=T3.Roomid)
How can I do this using a Select Query Only
ie, Select Query and Select Subquery
Help is appreciated.
Thanks
June 24, 2008 at 3:01 am
Is this what you have in mind?
SELECT T1.Course
, T1.Site
, T3.Room_Name
FROM T1
JOIN T3 ON T1.Roomid = T3.RoomId
Have a look at JOIN http://msdn.microsoft.com/en-us/library/ms191517.aspx
Also, you may want to look at views, to replace your T2 table.
Regards,
Andras
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy