I have a table “user” with a few rows that are both foreign keys for the same table “content” kinda like this:
user.id
user.bio
user.signature
content.id
content.text
I know this is not the right way to do this from a normalization standpoint, but the “content” table is from a separate DB that I cant modify. And I dont want to duplicate the data.
Im having a problem finding a good way to join them. All I have been able to do is this, but this seems wasteful.
SELECT bio.bio, text.text
FROM(
SELECT content.text as bio
FROM content, user
WHERE user.bio = content.id
AND user.id = 4) AS bio,
SELECT content.text as content
FROM content, user
WHERE user.signature = content.id
AND user.id = 4) AS content
You can join one table multiple times if you give each instance a different alias: