I have three tables. One of the table is main table(TRIP). The other two tables are having foreign key to the main table. I want to query data which are in both tables and the condition on each table. Here is my code:
SELECT L#
FROM TRIP
WHERE REG# IN
(
SELECT REG#
FROM TRUCK
WHERE REG# = 'PKR768'
)
AND T# IN
(
SELECT T#
FROM TRIPLEG
WHERE TRIPLEG.DEPARTURE = 'Melbourne'
)
ERROR = missing right parenthesis
AFTER EDIT:
THERE IS ONLY ONE ROW RETURNED FROM TRUCK TABLE SO THE OUTPUT OF WHOLE SHOULD NOT BE MORE THAN 1 ROW BUT IT IS MORE THAN 1.