I'm new to SQL queries and I'm trying to join two tables
I need to get all data of the followers of userID = 2
here's the error i get : Syntax error: Encountered "INNER" at line 1, column 39.
and here's the SQL query I ran :
SELECT * FROM FOLLOWER
WHERE userID = "2"
INNER JOIN USERS ON FOLLOWER.Follower_userID = USERS.userID
ORDER BY USERS.follower_count ASC
The tables in my DB are :
FOLLOWER
USERS
P.S I'm using Apache Derby.
Thank you so much guys.
position of where clause was incorrect
structure of SELECT query is
SELECT fields
FROM tables
WHERE conditions
ORDER BY fields
so you query should be
SELECT *
FROM FOLLOWER INNER JOIN USERS ON FOLLOWER.Follower_userID = USERS.userID
WHERE userID="2"
ORDER BY USERS.follower_count ASC