这是表的结构:
Table1
product_code - product_price
100001 - 100
Table2
product_code - product_price
100001 - 200
Table3
product_code - product_price
100001 - 300
Table4
product_code - product_price
100001 - 400
Table5
product_code - product_price
100001 - 500
Table6
product_code - product_price
100001 - 600
这个查询显然没问题
$price = DB::queryFirstRow("
select * from Table1, Table2, Table3, Table4, Table5, Table6
where Table1.product_code = Table2.product_code AND Table1.product_code = 100001");
根据数据库内的顺序最后一个表的价格
echo $price['product_price']; // 600 the price of the last table according to the order within the db
我尝试按最低价格订购以获得 100 个结果
$price = DB::queryFirstRow("
select * from Table1, Table2, Table3, Table4, Table5, Table6
where Table1.product_code = Table2.product_code AND Table1.product_code = 100001 ORDER BY product_price");
我收到这个错误
// ERROR: Column 'product_price' in order clause is ambiguous
任何如何解决它的想法,非常感谢您的帮助!
白衣非少年
qq_遁去的一_1