panosgr General User

Joined: 03 Apr 2008 Posts: 8
|
Posted: Sun Nov 01, 2009 11:39 pm Post subject: SQL query and repeating values trouble |
|
|
Hi from Athens,
I have a mySQL data base and I'm in big trouble with a query I want to make.
The datebase has 3 tables (related by the field customer_id)
table1:
customer_id
name
table2:
customer_id
charges_id
date
amount
table3:
customer_id
payement_id
date
amount
customer1 has 2 charges and 1 payement
customer2 has 0 charges and 0 payements
customer3 has 2 charges and 3 payements
the result of my query is:
customer_id charges_id payement_id
customer1 charge1 payement1
customer1 charge2 payement1
customer2 - -
customer3 charge1 payement1
customer3 charge2 payement2
customer3 charge2 payement3
How can I avoid to have this repeating data in some of the rows?
Any help will be very welcome! |
|