我有 2 张桌子,门票和状态。门票具有对应于 state.id 的外键状态
SELECT tickets.id AS 'Ticket Id',
state.description AS 'State'
FROM tickets
LEFT JOIN state ON tickets.state = state.id
WHERE tickets.id = 1;
因此,如果我在门票中有一排 ticket.id = 1 和 ticket.state = 1 并且我在 state.id = 1 和 state.description = 'Open' 的状态中有一行
如何获得结果 Ticket Id = 1,State = Open?
编辑:这确实有效,由于某种原因状态表是空的......