I am try to merge merge these 2 statements into a Single select and add a checkedField with values Y or N. All records from PlaneType should be returned and checkField = Y if a pilot has that specific PlaneTypeId.
PlaneType Table:
PlaneTypeId (primary key), PlaneTypeDescription
PilotPlaneType Table:
PilotId, PlaneTypeId (no primary key for this table)
select * from PlaneType
select * from PilotPlaneType where PilotId = 13081
I am not sure where to put the logic for checkedField (Y or N) to get this to work:
SELECT a.*,
b.pilotId,
c.checked
FROM PlaneType a, Pilot b,
(SELECT planeTypeId checked
FROM PlaneType ) c
WHERE b.pilotId= 13081
PlaneType Table:
PlaneTypeId (primary key), PlaneTypeDescription
PilotPlaneType Table:
PilotId, PlaneTypeId (no primary key for this table)
select * from PlaneType
select * from PilotPlaneType where PilotId = 13081
I am not sure where to put the logic for checkedField (Y or N) to get this to work:
SELECT a.*,
b.pilotId,
c.checked
FROM PlaneType a, Pilot b,
(SELECT planeTypeId checked
FROM PlaneType ) c
WHERE b.pilotId= 13081