kevin.de.wulf Posted April 11, 2018 Share Posted April 11, 2018 Hiif I want to use this query below select b.naam, b.voornaam,if(bu.typeid='2',bu.bedrag,0) as 'inkomst', if(bu.typeid='1',bu.bedrag,0) as 'uitgave',bu.datum,@total:= @total + if(bu.typeid=2,bu.bedrag,0) -if(bu.typeid=1,bu.bedrag,0) as 'totaal'from bewoners_uitgaven bujoin bewoners b on b.id = bu.bewonerIDjoin kl_bewoners_uitgave_type kl on kl.id = bu.typeidwhere b.Id =150;[/code]I got null as a result for totaal, can I use @var in my mysqlstatement? Link to comment Share on other sites More sharing options...
kevin.de.wulf Posted April 11, 2018 Author Share Posted April 11, 2018 I solved it,if I add an extra join join (select @total :=0 ) r[/code]it works Link to comment Share on other sites More sharing options...
m.kamran Posted April 11, 2018 Share Posted April 11, 2018 Glad you were able to resolve it Kevin. On a side note though, yes you can use variables in your SQL query for jasper reports.Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now