Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How does one display diff between two TDBText components?

Status
Not open for further replies.

delphiman

Programmer
Joined
Dec 13, 2001
Messages
422
Location
ZA
I have a TQuery (qryGLTBLeft)
SELECT SUM (Balance)
FROM "c:\h\StdAcc\GL" t1
WHERE t1.Balance > 0

I have a TQuery (qryGLTBRight)
SELECT SUM (Balance)
FROM "c:\h\StdAcc\GL" t1
WHERE t1.Balance < 0

Each results in a field &quot;SUM OF Balance&quot; which I can easily
display from a TDBTextLeft and TDBTextRight - each having
a DataField Property.

But I need to somehow display the difference between
TDBTextLeft and TDBTextRight from (say) TDBTextDiff.


How can I do this?

 
Try this - I think it should work....

SELECT SUM(t1.Balance) - SUM(t2.Balance)
FROM &quot;c:\h\StdAcc\GL&quot; t1, &quot;c:\h\StdAcc\GL&quot; t2

WHERE t1.Balance > 0
and t2.Balance < 0


or you could try

SELECT SUM(abs(t1.Balance))
FROM &quot;c:\h\StdAcc\GL&quot; t1

I think SQL has an ABS function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top