What I am wanting to do is display all the accounts of the customers in my database.
The problem is I have a separate user, account, and usertype tables.
The usertype table is linked to the users table with the foreign key fk1_user_type
and the accounts table is linked to the users table with fk1_user_id.
To find out whether or not the record in the account table belongs to a customer you have to use the foriegn key fk1_user_id to match it with the record in the users table from where you can identify the account type by the foreign key fk1_user_type.
My problem is how do I get a query to do this as there are multiple customer accounts in the account table.
I don’t know where to start at minute I’ve got
SELECT * FROM users WHERE fk1_user_type = 'customers'
Which returns multiple rows but how can I match these rows using there user_id to the fk1_user_id in the account table to display all the accounts belonging to the customers.
Any Help Appreciated Thanks 😃