Mohit Kumar
Mohit Kumar

Reputation: 2059

Three tables join in SQL

I am newbie in SQL. I want to join three tables in SQL. Below is my query, please check and correct me where I am wrong -

Tables:

Query:

Select *
FROM CARD
INNER JOIN PGMeCode PGMeCode.Code = CARD.Code AND PGMeCode.CC = CARD.CC
INNER JOIN PGM PGM.Code = Card.Code
WHERE Card.ID = 'SomeThing'

I don't know what I am doing wrong. Please suggest me!!

Thanks in advance.

Upvotes: 0

Views: 364

Answers (2)

user909058
user909058

Reputation: 188

SELECT * FROM CARD INNER JOIN PGMeCode ON PGMeCode.Code = CARD.Code AND PGMeCode.CC = CARD.CC INNER JOIN PGM ON PGM.Code = Card.Code WHERE Card.ID = 'SomeThing';

Try this query

Upvotes: 0

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324610

You are missing the keyword ON, placed after the table name.

INNER JOIN tablename ON condition...

Upvotes: 5

Related Questions