如何使用连接查询来合并订单,客户,类别和产品表?请回复 [英] how to use join query to merge order,customer,category and product table?kindly reply
本文介绍了如何使用连接查询来合并订单,客户,类别和产品表?请回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
i想要使用加入查询
Hi everyone
i want to use join query
SELECT ord.orderid,cus.custid,cus.custname,cat.catid,cat.catname,pro.proid,pro.proname from 'order' as ord inner join 'customer' as cus on cus.custid=ord.custid innerjoin 'category' as cat on cat.catid=ord.catid innerjoin 'product' as pro on pro.proid=ord.orderid
我不知道它有什么问题
请帮助我
紧急
[edit]已添加代码块,拼写[/ edit]
i don't know what's wrong with it
kindly help me out
its urgent
[edit]Code block added, spelling[/edit]
推荐答案
innerjoin
应该是
shoud be
inner join
和
and
pro.proid = ord.orderid
应该是???
shoud it be ???
pro.proid = ord.proid
此外,你不能使用'order'作为表名,因为它是一个保留字MySQL的。但是你可以尝试使用反引号来将它包围起来,就像这些`order`一样,可以在101键盘的左上角找到反引号。对其他表格执行相同的操作。
In addition, you cannot use 'order' as table name as it is a reserved word in mysql. But you can try using backticks ` to enclose it like these `order`, the backtick can be found on the top left hand side of your 101 keyboard. Do the same for the other tables.
这篇关于如何使用连接查询来合并订单,客户,类别和产品表?请回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文