01-29-2011
47,
1
Join Date: Aug 2009
Last Activity: 11 June 2012, 6:16 AM EDT
Posts: 47
Thanks Given: 0
Thanked 1 Time in 1 Post
MySQL: Create a relation between two tables.
Hello everybody,
I'm having troubles creating a relation between two tables in a MySQL database.
Having two tables, being one which contains users information (username, password, user ID, etc) and the other the one which contains transactions information (operation type, user ID of the user who did the transaction, etc), How can i create a relation between any transaction done by each user?
I tried making user ID a primary key for both tables, but when i try to create a second entry with the same user ID on the 'Transactions' table, MySQL tells me that it must be unique, since it's a primary key.
What i want is to run a query for matching all the "transactions" made by an specific "user ID" , How can i do that?
Thanks in advance, and please excuse my poor english