lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: Query Output Issue
- Date: Fri, 23 May 2008 08:35:39 -0700
- From: "Rob Wultsch" <wultsch@xxxxxxxxx>
- Subject: ***BOGO*** Re: Query Output Issue
On Fri, May 23, 2008 at 11:27 AM, <mdimartino@xxxxxxxxxxxxxxxxx> wrote:
> I have a table that has two has two secondary keys referencing the same primary key of another.
>
> Table-name =Circuits
> circuitID
> CircuitID
> A_loc
> Z_loc
>
> Table-name = Location
> locationID
> location
>
> circuits.A_loc references locatioin.locationID
> circuits.Z_loc references locatioin.locationID
>
>
> How do i achieve the following output.
>
> circuitID Location A LocationZ
> 98129 BOSTON ATLANTA
>
>
> Do I actually have to create two location tables one for the A location and one for the Z location.
SELECT circuitID,
l1.location AS 'Location_A',
l2.location AS 'Location_Z'
FROM Circuits
INNER JOIN Location AS l1 WHERE circuits.A_loc =l1.locationID
INNER JOIN Location AS l2 WHERE circuits.Z_loc =l2.locationID
--
Rob Wultsch
wultsch@xxxxxxxxx
wultsch (aim)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx