1
SELECT posts.content, posts.title, owners.firstname, 
owners.lastname, owners.email 
FROM posts,owners JOIN posts ON posts.owner_id = owners.owner_id;

I am trying to display (content, title, firstname, lastname, email) from both the tables (owners with the fields -owner_id,firstname,lastname,email and posts with the fields-id,owner_id,content,title,created_time,updated_time).

It shows,

'Not unique table/alias' error.

What's the solution to this? Thanks in advance.

3 Answers 3

1

Your query FROM part went wrong. You are kind a mixing old style and ANSI style JOIN syntax. It has to be like

FROM posts JOIN owners ON posts.owner_id = owners.owner_id;
Sign up to request clarification or add additional context in comments.

Comments

1
SELECT posts.content, posts.title, owners.firstname, owners.lastname, owners.email 
FROM owners 
JOIN posts ON posts.owner_id = owners.owner_id;

Comments

0

Your query seems to be wrong after FROM part, correct query is:

SELECT posts.content, posts.title, owners.firstname, owners.lastname, owners.email FROM posts JOIN owners ON posts.owner_id = owners.owner_id;

You can see more about JOIN in the link

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.