i need to write an SQL query which is similar to the following:
SELECT c.*, p.amount
FROM claims c, payments p
WHERE claims.debit < payments.amount AND c.customerId = p.customerId
Now the problem is, that this query only shows claims, which have a payment which belongs to this claims. But I want it to show every claim and if there's no belonging payment the amount should just be zero.
How can i achieve this?
Btw, I'm doing this in Firebird-SQL.
And sorry for the bad title, i have no idea how to describe it better.
Thank you for your help