Link to home
Start Free TrialLog in
Avatar of goautl
goautl

asked on

SQL Select Statement

I am attempting to create a select statement that will pair data with the correct record.  I have an ACCIDENT Table which contains the Accident Reports.  I then have a MASTER Table that holds the units involved in the accident.  The third table is the VEHICLE table which will hold all of the codes related to the Unit Number that was in the ACCIDENT.  

The Key in the ACCIDENT table is the report number - OCA_T

The Master Table is using SELECT * FROM MASTER  WHERE OCA_T = ?CURRENTOCA and relation == "DRIVER"   -  (This is working fine)  In the Master Table the there is a field labeled NO which contains the Unit Number.

In my VEHICLE table, I have OCA_T and NO fields.  I want to have it pair up with the MASTER table if the OCA_T+NO == the Master.OCA_T+MASTER.NO.

I am using the following and it does not work....  SELECT * FROM VEHICLE where OCA_T = ?CURRENTOCA .AND. NO = MASTER.NO order by accident  (the accident order is a simple OCA_T+NO)

Any help is greatly appreciated!!

I am using the Select statement as it works with my my Visual Fox Tables as well as SQL.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia 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