Linked Questions

Popular Questions

I wanna have a bidirectional relationship between my two tables that are related by a one to many relationship.

So, i have a User table, with columns such as user_id, and transaction_id etc (and other user datails columns).

I have another table called transaction which has columns like transaction_id and user_id (to refer to the user this particular transaction belongs to).

Now, the issue is, a particular user can have multiple transactions attached to them, which means, this transaction table can have multiple rows for the same user. This makes it easy for me to get user details via join query. But I want to make this relationship bi-directional.

As in, if all i have is user details, i should be able to get the transaction details of that person. but since, a user can have multiple transactions at once, I'm not able to write a join query.

As such, I am yet to figure out how to store two transaction id's for a particular user, keeping in mind that i should be able to make a join query having the user details (I could always store transaction id's in the form of an array, but that won't let my join query happen).

Related Questions