我一直在研究MySQL,通过一本名为'PHP和MySQL Web Development'的书,我正在讲授如何从多个表中查询数据的一章,我试图在我自己并想出了下面的命令查询MySQL上的多个表
mysql> select customers.name from books, customers, orders, orders_items
-> where books.title = 'Java 2'
-> and books.isbn = orders_items.isbn
-> and orders_items.orderid = orders.orderid
-> and orders.customersid = customers.customerid;
,并返回我下面的错误
ERROR 1146 (42S02): Table 'books.orders_items' doesn't exist
但是当我尝试使用完全相同的命令,因为它是在它工作得很好,这本书
mysql>select customers.name from customers, orders, order_items, books
->where customers.customerid = orders.customerid
->and orders.orderid = order_items.orderid
->and order_items.isbn = books.isbn
->and books.title = 'Java 2';
+-------------+
| name |
+-------------+
| Julie Smith |
+-------------+
除了标准的顺序,我在这里还缺少什么? 我还没有在任何地方输入books.orders_items。
你能描述/显示涉及的表架构? – RamRaider