T
toukey
I have a query 'pos' that extracts all the positive amounts from a
table called client_os and another query 'neg' that extracts all the
negative amounts from the same table both where the os_amt is <> 0.
I also have 2 other queries (uniquepos and uniqueneg) that would match
the osamt field in 'pos' and 'neg' and remove the record(s) that are of
the same value in both 'pos' and 'neg'. Example if neg has ($200.00)
and pos has $200.00 it would remove the record.
This works but I want it to only match the records where the client
number is the same in other words in the example above if the client
number and value is the same in both 'pos' and 'neg' I want it to
'matchup' and remove but if the client number or value is different I
want it to remain.
Below is the SQL code for uniquepos and uniqueneg which works fine
except if I have 2 positive values of say $200.00 and 1 negative value
of ($200.00), it applies the 1 occurrence of ($200.00) to the both
$200.00. I need the 1 negative amount to apply to 1 positive $200.00.
Uniquepos:
SELECT Pos.osamt, Pos.ClientNo, Pos.ClientName, Pos.Address1,
Pos.Address2, Pos.Address3, Pos.Address4, Pos.invdate, Pos.Invno,
Pos.PolicyNo, Pos.amount, Pos.Taxamt, Pos.Receiptamt, Pos.Currcode
FROM Pos LEFT JOIN Neg ON Pos.osamt=abs(Neg.osamt)
WHERE (((Neg.osamt) Is Null));
Uniqueneg:
SELECT Neg.osamt, Neg.ClientNo, Neg.ClientName, Neg.Address1,
Neg.Address2, Neg.Address3, Neg.Address4, Neg.invdate, Neg.Invno,
Neg.PolicyNo, Neg.amount, Neg.Taxamt, Neg.Receiptamt, Neg.currcode
FROM Neg LEFT JOIN Pos ON Neg.osamt=Pos.osamt*-1
WHERE (((Pos.osamt) Is Null));
Urgent assistance will be appreciated.
table called client_os and another query 'neg' that extracts all the
negative amounts from the same table both where the os_amt is <> 0.
I also have 2 other queries (uniquepos and uniqueneg) that would match
the osamt field in 'pos' and 'neg' and remove the record(s) that are of
the same value in both 'pos' and 'neg'. Example if neg has ($200.00)
and pos has $200.00 it would remove the record.
This works but I want it to only match the records where the client
number is the same in other words in the example above if the client
number and value is the same in both 'pos' and 'neg' I want it to
'matchup' and remove but if the client number or value is different I
want it to remain.
Below is the SQL code for uniquepos and uniqueneg which works fine
except if I have 2 positive values of say $200.00 and 1 negative value
of ($200.00), it applies the 1 occurrence of ($200.00) to the both
$200.00. I need the 1 negative amount to apply to 1 positive $200.00.
Uniquepos:
SELECT Pos.osamt, Pos.ClientNo, Pos.ClientName, Pos.Address1,
Pos.Address2, Pos.Address3, Pos.Address4, Pos.invdate, Pos.Invno,
Pos.PolicyNo, Pos.amount, Pos.Taxamt, Pos.Receiptamt, Pos.Currcode
FROM Pos LEFT JOIN Neg ON Pos.osamt=abs(Neg.osamt)
WHERE (((Neg.osamt) Is Null));
Uniqueneg:
SELECT Neg.osamt, Neg.ClientNo, Neg.ClientName, Neg.Address1,
Neg.Address2, Neg.Address3, Neg.Address4, Neg.invdate, Neg.Invno,
Neg.PolicyNo, Neg.amount, Neg.Taxamt, Neg.Receiptamt, Neg.currcode
FROM Neg LEFT JOIN Pos ON Neg.osamt=Pos.osamt*-1
WHERE (((Pos.osamt) Is Null));
Urgent assistance will be appreciated.