I have two tables in my database which I try to combine through a view, where the id
and user_id
should match up. I have checked out UNION ALL, but this doesn't seem to be the solution since the order of the entities in the tables can be different and they should be matched.
users:
id email password
--------------------------------------
1 eric@test.com sdgsdhdfhs
2 john@test.com dfgsdgdfhg
3 mary@test.com plkdfjvjvv
permissions:
index user_id allow_read allow_write allow_delete
-------------------------------------------------------------
1 2 1 0 1
2 3 1 1 1
3 1 0 0 0
which should become: (@Gordon Linoff)
id email password allow_read allow_write allow_delete
------------------------------------------------------------------------------
1 eric@test.com sdgsdhdfhs 0 0 0
2 john@test.com dfgsdgdfhg 1 0 1
3 mary@test.com plkdfjvjvv 1 1 1