Skip to content
Advertisement

SELECT *, SUM(NET) AS TOTAL FROM TABLE1 WHERE CLAUSE

I was hoping to add an IF statement before WHILE. Which will still display records even there is no match dv_id on both table2. It should still display records.. The COLUMN ROLLS IF No match it will display a 0.00 value. LINK>> http://i599.photobucket.com/albums/tt79/emcevo/viewphpdisplay_zpsfc6a8174.jpg

How can I display the TOTAL NET below code:

I top codes are all working.. The bold Section BUTTOM code is the Problem.

Advertisement

Answer

I guess you get downvotes because your whole php code-block is unnecessary as far I can see. Your query “$qry2” is incorrect; you can’t sum without a group by (unless you only do a sum). eg:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement