Link to home
Start Free TrialLog in
Avatar of alajoie
alajoieFlag for Canada

asked on

SQL QUERY WITH INNER JOIN ON 3 TABLE

Hi, I need to find record on 3 tables.

Find all Record on TBL_Transaction depend on the NoStock of TBL_Car on Specified Date ( after dateout and before DateIn )

find NoStock, FirstName, LastName, Dateout, DateIn

TBL_Transaction

Field

IdTransaction  CoutoisieId   ClientID  DateOut                 DateIn
3                        2                   1            2012-01-24         2012-01-25
4                        3                   2            2012-02-25         2012-01-26

TBL_Client

Field

IdClient    LastName      FirstName
1               hamel            martin
2               hamel            steve

TBL_Car

Field

IdCourtoisie   NoStock   Marque  Model      Annee
2                     1081         toyota   corolla      2012
3                      1082         toyota   matrix      2012
Avatar of Alfredo Luis Torres Serrano
Alfredo Luis Torres Serrano
Flag of United States of America image

how is the tabls relation?

Is clear that

CoutoisieId in tbl_transaction match with IdCourtoisie on table car but what about tbl_client
Provide the expected result.
check code which might give expected result
SELECT t.*,c.LastName,c.FirstName,cr.NoStock,cr.Marque,cr.Model,cr.Annee FROM TBL_Transaction t,TBL_Client c,TBL_Car cr
WHERE c.ClientID=t.ClientID AND cr.IdCourtoisie=t.IdCourtoisie

Open in new window

Regards,
nishant
ASKER CERTIFIED SOLUTION
Avatar of alajoie
alajoie
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alajoie

ASKER

The Awnser is more complete With Date and INNER JOIN parameters