Reputation: 23
I'm using mysql connector to connect visual basic with mysql,i m doing mysql query with 3 tables and i tried with inner join and the "normal mode" with the "normal mode" said not unique table/alias and with inner join the datagrid doesnt load anything,the three table are this ones
Order(N_Order,Date,Client Number)
Line_Order(N_Order,product_code,quantity)
Product(product_code,name,price)
and the mysql query with innerjoin is:
"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 "
and the normal way is:
"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"
When i run the 2º mysql query in phpmyadmin it works perfectly but when i run it in visual basic it gives me the error not unique tables alias/order i dont know what to do can someone help me please??
Upvotes: 1
Views: 1283
Reputation: 23
Its Solved it was from the datagridview size was too little for the data,2 hours on this because of the datagridview size,thanks guys for the help
Upvotes: 0
Reputation: 51711
Put backticks `
around the table `order`
as it conflicts with the reserved keyword in ORDER BY
.
Upvotes: 2