Local SQL 'HAVING' syntax help

Hello

[I hope a local SQL question is OK here]

The following SQL works fine, but what I really need is for the
HAVING clause to compare the SUM(D1.PaymentAmount) to the
D.TotalExtended value instead of comparing to the number 100, as
shown.

When I plug in D.TotalExtended as the comparison, the syntax works
fine but the result set acts as if D.TotalExtened is always zero,
meaning it's not getting evaluated in the HAVING clause.

Is there any way to accomplish this?  I'm trying to show all open
invoices along with the sum of payments from a payments table - but
if they're fully paid I don't want to select the invoice record.

Thanks for taking the time!

SELECT
D.InvoiceNumber,
D.TotalExtended,
SUM(D1.PaymentAmount) as TotalPaid,
D2.CompanyName
FROM
  ":JPI_DATA:INVOICE.DB" D
LEFT OUTER JOIN
  ":JPI_DATA:PAYMENT.DB" D1 ON
  (D1.InvoiceNumber = D.InvoiceNumber)
WHERE
  (D.InvoiceDate > '6/1/1999')
GROUP BY
  D.InvoiceNumber,
  D.TotalExtended,
  D2.CompanyName
HAVING
  ((SUM(D1.PaymentAmount)) < 100)

[I *want* the HAVING clause to read: HAVING (SUM(D1.PaymentAmount) <
D.TotalExtended), but it does not evaluate correctly]

P.