I am supposed to get all the rows where an id matches another id…
This is code, I have to link 2 tables…
SELECT *
FROM acw_papers_web
WHERE id_paper_web = ( SELECT id_paper_web
FROM acw_papers_web_autores
WHERE nombre_autor_pw LIKE'%Chicaiza%' )
I get the error: Subquery returns more than 1 row
I noticed why…
But insted of fixing it with a php code (i’m working with that) that gets each id and sends the query for each one of those, I’d like to do it with sql.
You could also use
EXISTS()instead ofIN(), which might be a little bit faster.DEMO