我有这些带有一些值的表。
ticket_detail
ticket_header
route_header
route_detail
fleet_header
现在我有这个问题,我必须写查询。
Select common ticket numbers
from ticket header and ticket detail
where route ids are greater than route_id
which belong to the place with id ‘04’.
编辑 我试过用
select * from
(select ticket_number
from ticket_header
union
select ticket_number from ticket_detail)
where route_id > (select route_id from ticket_detail where id = 4)
我尝试使用子查询来做到这一点,但这让我感到困惑。我们如何在一个查询中关联这三个查询?