2016-05-29 104 views
0

我想在視圖中加入3個表格;這裏是我的情況:Sql三表內部加入?

我有一個包含銷售它內含詳細銷售每件 另售主A所有項目的所有銷售詳細.. 而另一個清單詳細

String query = "SELECT SALE.ITEM_CODE, SALE.ITEM_NAME, SALE.UNIT, " 
      + "SALE.QNTY, SALE.AMOUNT, SALE_MASTER.LONGDATE, SALE_MASTER.BILL_NO, " 
      + "SALE_MASTER.LEDGER_CODE, SALE_MASTER.LEDGER_NAME FROM SALE " 
       + "INNER JOIN SALE_MASTER" 
      + " ON SALE.BILL_NO = SALE_MASTER.BILL_NO SALE" 
       + "INNER JOIN INVENTORY ON SALE.ITEM_CODE = INVENTORY.ITEM_CODE" 
       + "WHERE "+CATORINORG+" LIKE '%"+LIKE+"%' " 
       + "AND (SALE_MASTER.LONGDATE >= " + From + " AND SALE_MASTER.LONGDATE <= " + To + ")"; 

是它的表正確的方法..感謝ADV

+1

問題是什麼? – sagi

+0

查詢 –

+0

有錯誤...錯誤是? – sagi

回答

0
SELECT SALE.ITEM_CODE, SALE.ITEM_NAME, SALE.UNIT, " 
      + "SALE.QNTY, SALE.AMOUNT, SALE_MASTER.LONGDATE, SALE_MASTER.BILL_NO, " 
      + "SALE_MASTER.LEDGER_CODE, SALE_MASTER.LEDGER_NAME FROM SALE " 
      + "INNER JOIN SALE_MASTER" 
      + " ON SALE.BILL_NO = SALE_MASTER.BILL_NO" 
      + " INNER JOIN INVENTORY ON INVENTORY.ITEM_CODE = SALE.ITEM_CODE" 
      + " WHERE "+CATORINORG+" LIKE '%"+LIKE+"%' " 
       + "AND (SALE_MASTER.LONGDATE >= " + From + " AND SALE_MASTER.LONGDATE <= " + To + ") 

它的工作對我來說