How do I get a nested query to only display content that the main query outputed

How do I get a nested query to only display content that the main query outputed

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)