Mysql Groupby and Orderby problem

Posted by luvboy on Stack Overflow See other posts from Stack Overflow or by luvboy
Published on 2010-04-01T07:27:18Z Indexed on 2010/04/01 7:33 UTC
Read the original article Hit count: 393

Filed under:
|
|
|

Here is my data structure

alt text

when i try this sql

select rec_id, customer_id, dc_number, balance
from payments
where customer_id='IHS050018'
group by dc_number
order by rec_id desc;

something is wrong somewhere, idk

I need

rec_id  customer_id   dc_number   balance

2        IHS050018      DC3        -1
3        IHS050018      52         600 

Thanx

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-query