Page 1 of 1

PHP CODE

Posted: Tue Aug 05, 2014 4:19 am
by thomasvt28
ID CUSTOMER_ID WEEK_NO TOTAL

1 100 31 100
2 101 31 150
3 100 31 400


My table like above,...i need to take add total,if the customer id and week period is same..how to do this..?

Customer_id 100=500 & Customer_id 101=150..(i need result like this))

please do help/...please fast

Re: PHP CODE

Posted: Tue Aug 05, 2014 7:04 am
by Celauran
We're not doing your homework for you. What have you tried? What errors are you encountering?

Re: PHP CODE

Posted: Tue Aug 05, 2014 11:58 pm
by thomasvt28
used group by to select from database but it returns last row only

Re: PHP CODE

Posted: Wed Aug 06, 2014 6:47 am
by Celauran
GROUP BY is the correct approach, but it should return two rows. What's your exact query?

Re: PHP CODE

Posted: Thu Aug 07, 2014 1:27 am
by thomasvt28
Got answer