我有这段代码并且不断收到语法错误。
query = "SELECT * "+
"FROM Product " +
"INNER JOIN Orders ON (Product.ItemID=Orders.ItemID) " +
"LEFT OUTER JOIN SupplierProduct ON (Orders.ItemID=SupplierProduct.ItemID) "+
"WHERE Product.Receiver = 'Fred' " +
"ORDER BY Product.ItemName";
DefaultTableModel data = table.getQuery(query);
我也尝试过INNER JOIN
代替LEFT OUTER JOIN
. 我不断尝试的错误是。
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '(Product.ItemID=Orders.ItemID) LEFT OUTER JOIN SupplierProduct ON (Orders.ItemID=SupplierProduct.ItemID'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
我在这里缺少什么或如何加入三个表。