having 句で問題が発生しています。これは、次のエラーです。
tbl_quotes.tax
の不明な列having clause
と私のコード:
SELECT tbl_quotes.docnumber AS docNumber,
tbl_quotes.date AS date,
Sum(tbl_quotesitems.price) * ( ( tax + tax2 / 100 ) + 1 ) AS total,
( Sum(tbl_quotesitems.price) * ( ( tax + tax2 / 100 ) + 1 ) ) -
(SELECT Sum(tbl_payments.amount)
FROM tbl_payments
WHERE tbl_payments.quoteid = tbl_quotes.id
) AS amtOwing
FROM tbl_quotes
INNER JOIN tbl_quotesitems
ON tbl_quotesitems.quoteid = tbl_quotes.id
GROUP BY tbl_quotes.id
HAVING ( Sum(tbl_quotesitems.price) * ( ( ( tbl_quotes.tax + tbl_quotes.tax2 ) /
100 )
+
1 ) ) < (SELECT Sum(
tbl_payments.amount)
FROM tbl_payments
WHERE
tbl_payments.quoteid = tbl_quotes.id)
ありがとう