List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:July 2 2006 2:42pm
Subject:Re: Query multiple tables
View as plain text  
 >What query do I need to get
 >AccommodationName and what attractions it has from 
AccommodationAttractions

SELECT
  ac.accommodationname,
  at.attractionname
  aa.AccomodationAttraction
FROM
  accommodationattractions AS aa
INNER JOIN accommodations AS ac USING (accommodationid)
INNER JOIN attractions AS at USING (attractionid);

PB

-----

Neil Tompkins wrote:
> Hi,
>
> How do I query multiple tables.  For example I have
>
> TableName      Accommodation
> Field1             AccommodationID
> Field2             AccommodationName
>
> I also have
>
> TableName     Attractions
> Field1            AttractionID
> Field2           AttractionName
> Field3           AttractionDescription
>
> Then I have
>
> TableName     AccommodationAttractions
> Field1            AccommodationAttractions
> Field2           AccommodationID
> Field3           AttractionID
>
> What query do I need to get
>
> AccommodationName and what attractions it has from 
> AccommodationAttractions
>
> Thanks
> Neil
>
>
>


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.8/380 - Release Date: 6/30/2006

Thread
Query multiple tablesNeil Tompkins2 Jul
  • Re: Query multiple tablesPeter Brawley2 Jul