多个InnerJoin

时间:2016-05-29 07:44:34

标签: sql database

我想将一个多表连接到Inner,但不知何故,FROM不是读取。列没有填充数据。但是他们正在生成列。 FROM Statement是错的吗?

SELECT Customer.CID, Customer.FName, Customer.LName, Customer.Address, Customer.ContactNo,
   Book.BID as Book_SerialNo, Book.Title, ShoppingCart.Quantity, Order1.Status, Order1.ODate

FROM Customer Inner Join ShoppingCart on Customer.CID = ShoppingCart.CID, 
 Order_Book_Junction Inner Join Book on Order_Book_Junction.BID = Book.BID
 Inner Join Order1 on Order_Book_Junction.OID = Order1.OID

1 个答案:

答案 0 :(得分:0)

它的sql问题不是C#

你应该在sql中运行它并查看错误消息或者可能不是错误查询没有返回任何行,Change From语句到(可能有帮助):

   FROM Customer 
   Inner Join ShoppingCart
          on Customer.CID = ShoppingCart.CID 
   Inner Join Book
          on Order_Book_Junction.BID = Book.BID
   Inner Join Order1
          on Order_Book_Junction.OID = Order1.OID