Hi everyone,i'm new in the forum and in MySQL too.i have one question and i can't find a way to answer it.
if i have 2 tables in one database,customers and customers_payments.how can create a connection between them in order to join them and get for example a payment_date for a user?
when i design them i have something like this in my mind:
customers (id not null unsigned auto_increment, fanme varchar, lname varchar, email varchar, primary key(id)
customers_payment(id not null unsigned,customer_id not null auto_increment,months int, payment_date varchar,foregn key(id),primary key(customer_id)
So how do i make a join between those two,when i design them i make id a primary key,how am i supposed to put the id as foreign key in the customers_payment?plz if anyone has any idea or explanation of how should i continue post it
thanks in advance
thanks for the reply.it's a good suggestion but i can't understand how mysql understands that the two id's are connected,and if i have many records how it will now that the correct user has the ceorrect id,if i try to connect php and mysql?
If u create a table type innodb then mysql will understand parent child relation ship other wise which query i was given in that mysql will not understand parent child relation ship, its just an dba assumption of parent child relationship.