Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Getting data from two table with the PK displayed

Author  Topic 

-z-
Starting Member

3 Posts

Posted - 2008-10-12 : 15:21:55
use database

SELECT Multi_centre, Location,ArrivalDate
FROM dbo.Tour, dbo.Destination
where dbo.tour.TourID = dbo.Destination.TourID AND Multi_centre ='Yes'
order by arrivaldate

basically my query already able to get all the data i needed from the two tables but i want to display the TourID as well in my result... IS that possible ? pls advice... Thank you. (TourID = PK in Tour Table and FK in Destination table)

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-12 : 15:32:36
SELECT Multi_centre, Location,ArrivalDate, dbo.tour.TourID
FROM dbo.Tour, dbo.Destination
where dbo.tour.TourID = dbo.Destination.TourID AND Multi_centre ='Yes'
order by arrivaldate


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

-z-
Starting Member

3 Posts

Posted - 2008-10-12 : 16:25:53
thank you so much =)
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2008-10-12 : 21:28:08
Select Multi_centre,Location,ArrivalDate from Tour
inner join Destination on Tour.PK=destination.Fk
where Tour.Multi_centre='Yes'
order by Tour.arrivaldate
Go to Top of Page
   

- Advertisement -