我正在使用 mysql 连接器将 Visual Basic 与 mysql 连接,我用 3 个表进行 mysql 查询,我尝试使用内部联接和“正常模式”,“正常模式”表示不是唯一的表/别名,内部加入数据网格不加载任何东西,三个表就是这个
Order(N_Order,Date,Client Number)
Line_Order(N_Order,product_code,quantity)
Product(product_code,name,price)
并且带有 innerjoin 的 mysql 查询是:
"SELECT c.name, COUNT( b.product_code ) AS cnt FROM order a " & _
"INNER JOIN line_order b ON a.number_order = b.number_order " & _
"INNER JOIN product c ON b.product_code = c.product_code " & _
"GROUP BY c.name " & _
"ORDER BY cnt DESC "
正常的方法是:
"SELECT product.name, COUNT( order_line.product_code ) AS cnt
FROM order, product, order_line where order.number_order = order_line.number_order
AND order_line.product_code = product.product_code
GROUP BY product.name
ORDER BY cnt DESC
LIMIT 0 , 5"
当我在 phpmyadmin 中运行 2º mysql 查询时,它工作得很好,但是当我在 Visual Basic 中运行它时,它给了我错误不是唯一的表别名/顺序我不知道该怎么做有人可以帮我吗?