我有两张桌子:
债务人
debtorid
name
inactive
货车
rfnwagonid
dumpid
customerid
allocationdate
debtorid
有 2 个值 21 和 22:
- 21 表示客户
- 22 表示转储
我想显示整rfnwagon
行,但不是使用dumpid=21
and customer_id=22
,而是使用 table 中的名称debtor
。我试过这个但失败了:
SELECT
rfnwag.rfn_wagon_id,
debtor.name,
debtor.name,
rfnwag.no_of_wagons,
rfnwag.order_id,
rfnwag.product_id,
rfnwag.destination,
rfnwag.allocation_date
FROM rfn_wagon_allocation as rfnwag,
debtors_master as debtor
WHERE rfnwag.customer_id=debtor.debtor_no AND rfnwag.dump_id=debtor.debtor_no"