Try with :

SELECT tparts.name,
               a.name,  
               b.name,  
                tmovement.quantity
FROM    tmovement inner join tparts on (tmovement.part_id = tparts.Id)
                                     inner join twarehouse a on (
tmovement.incoming_id =  a.Id )
                                     inner join twarehouse b on (
tmovement.outgoing_id =  b.Id )


Ulises

-----Mensaje original-----
De: Gyurasits Zoltan [mailto:[EMAIL PROTECTED]
Enviado el: Martes 18 de Febrero de 2003 04:11 PM
Para: MYSQL Lista
Asunto: SELECT help


HI all!


I want make the SELECT  for this situation.....

Example:

Twarehouse
------------------------------
ID        name
---        --------
01        Spring_WH
02        Screw_WH
03        Toll_WH


Tparts
--------------------------
ID        name
---        --------
01        M3 screw
02        M4 screw
03        Hammer



Tmovement
----------------------------------------------------------------------------
------
part_ID         incoming_ID        outgoing_ID         quantity
-----------        -----------------         -----------------
------------
01                01                        02                    10
02                01                        03                    1
03                02                        01                    5



I want build list about movement, with warehouse's names....

SELECT
                twarehouse.name,  ??????????            # incoming warehouse
name
                twarehouse.name,  ??????????            # outgoing warehouse
name

                tparts.name,
                tmovement.quantity
FROM
                tparts, twarehouse
INNER JOIN      tmovement
ON    
        tmovement.part_ID=tparts.ID 
----------------------------------------------------------------------------
AND 
        tmovement.incoming_ID=twarehouse.ID   ????????
AND
        tmovement.outgoing_ID=twarehouse.ID   ????????


Please help me, who can ..... How can I do??
I don't want make temorary table, if is possible....


Thank You!!!!!


Reply via email to