0
SELECT ma.openingbalance,
ma.closingbalance,
ct.currentopeningbalance AS AmtBeforeTransaction,
ct.currentclosingbalance AS AmtAfterTransaction,
ct.transactionnumber,
ct.transactionid,
ct.ammount
FROM masteraccount AS ma
INNER JOIN companytransactions AS ct
ON ma.companyid = ct.companyid
WHERE (ct.transactionid = (SELECT Max(ct.transactionid) AS max
FROM companyfinancials
WHERE (ma.financialid = 1)
AND (ma.companyid = 1)))
AND (ct.companyid = 1)
AND (ct.financialid = 1)
連接查詢和子查詢單獨運行正常。但是當我把它們放在一起時,不同的錯誤會在不同的時間出現,所有這些錯誤都像'錯誤代幣'一樣選擇不同的行和偏移量。請幫助我內部加入子查詢在哪裏條件,顯示令牌錯誤'選擇'
你能把這件事在SQL小提琴? – DevelopmentIsMyPassion
當單獨運行時,你的子查詢如何可以無法解釋。 MAX(ct.transactionid)as max'試圖引用子查詢 – Steve
中不存在的表,而不是第一個地方的整個WHERE成爲JOIN標準的一部分? –