MySQL Forums
Forum List  »  Newbie

Adding variables
Posted by: Gideon Engelbrecht
Date: July 19, 2022 12:16AM

Hi all

I am trying to add two variables together, but am getting a zero value.

set @UitvoerRooiwyn = (select sum(Liter) from verkope WHERE InUit = 'EXPORT' AND TipeProduk = 'Wyn' AND Kleur = 'Rooi');
set @UitvoerWitwyn = (select sum(Liter) from verkope WHERE InUit = 'EXPORT' AND TipeProduk = 'Wyn' AND Kleur = 'Wit');
set @HaweRooiwynBinnelands = (select sum(LiterPerPad) from ccc_verspreiding WhERE Kommoditeit = 'Wyn(rooi)' AND RoetePerPad = 'Hawe');
set @HaweWitwynBinnelands = (select sum(LiterPerPad) from ccc_verspreiding WhERE Kommoditeit = 'Wyn(Wit)' AND RoetePerPad = 'Hawe');
set @TotaleRooiwynHawe = @HaweRooiwynBinnelands + @UitvoerRooiwyn;

select @UitvoerRooiwyn,@HaweRooiwynBinnelands,@TotaleRooiwynHawe ;

My issue lies here : set @TotaleRooiwynHawe = @HaweRooiwynBinnelands + @UitvoerRooiwyn;


@TotaleRooiwynHawe gives a zero result. Though @UitvoerRooiwyn is not zero and @HaweRooiwynBinnelands is zero.

What am I missing ?

Regards

Options: ReplyQuote


Subject
Written By
Posted
Adding variables
July 19, 2022 12:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.