budimir Posted December 15, 2015 Share Posted December 15, 2015 Guys how can I make this query work SELECT SUM(iznos_fakture) as ukupno FROM fakture_placanja WHERE iznos_placanja != iznos_fakture AND MONTH(datum_dospijeca) = '12' I need to find where iznos_placanja is different from iznos_fakture. They are two columns in same DB? Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/299759-difference-between-two-columns/ Share on other sites More sharing options...
Barand Posted December 15, 2015 Share Posted December 15, 2015 (edited) If we knew your input data, what you are getting and what you expect to get then maybe we'd have some ideas. Edited December 15, 2015 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/299759-difference-between-two-columns/#findComment-1527980 Share on other sites More sharing options...
budimir Posted December 15, 2015 Author Share Posted December 15, 2015 (edited) iznos_fakture (DECIMAL (10,2)) is amount of invoice to be payed iznos_placanja (DECIMAL (10,2)) is amount payed for that invoice MONTH(datum_placanja) is month when that invoice is due I would like to find all invoices in december that are not yet payed. I see in table that there are two invoices not payed. For some reason I can't display them. No errors. I'm getting empty result. Edited December 15, 2015 by budimir Quote Link to comment https://forums.phpfreaks.com/topic/299759-difference-between-two-columns/#findComment-1527981 Share on other sites More sharing options...
Solution budimir Posted December 15, 2015 Author Solution Share Posted December 15, 2015 Found a problem. It was nulls allowed and it should be 0 in all records. Quote Link to comment https://forums.phpfreaks.com/topic/299759-difference-between-two-columns/#findComment-1527982 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.