I've seen this post which almost coincides with my question but my specific problem is that I need to put a limit to the third table/query, as in LIMIT 15
, for example. Is there an easy way to achieve this? Thanks!
EDIT
My SQL SELECT statement would look something like this:
SELECT t2.name AS user_name, t3.name AS artist_name
FROM tbl1 t1
INNER JOIN tbl2 t2 ON t1.t1able_id = t2.id
INNER JOIN (SELECT * FROM tbl3 WHERE artist_id = 100 limit 15) t3
ON t2.id = t3.artist_id
WHERE t1.kind = 'kind'
To clarify: It's just a matter of joining two tables but the second table has two states. First state as a "common user" and the next state as an "artist" (both using the same table, e.g. users
).