Board index » delphi » What is the difference ?
Erkin ESKIER
![]() Delphi Developer |
What is the difference ?2004-04-30 06:22:59 PM delphi276 Hi guys, Could someone tell me what is the diffrence in these queries. ( Assume they are functions ) Func 1: .... set x = ( select sum(case type when 'B' then ( value*ccy_rate) when 'A' then -( value*ccy_rate) end ) from fo_posting where folio_id=675 ) .... Func 2: .... set x=(select sum(value*ccy_rate) from fo_posting where folio_id=675 and type='B' ) set x = x - ( select sum(value*ccy_rate) from fo_posting where folio_id=675 and type='A' ) .... Table fo_posting is some kind of transaction table. You know, debit, credit things. "type" is kind of transaction. The first one returns wrong result ! Are these two queries should return same result ? Or something wrong with the "case" statement. I am confused with this. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (www.grisoft.com). Version: 6.0.671 / Virus Database: 433 - Release Date: 28/04/2004 |