MySQL: joins, The used SELECT statements have a different number of columns -
i know there more questions can`t find right answer me.
this query:
$query = $mysql->query("( select questions.*, tags.tagdata questions left join tags on questions.id = tags.questid ) union ( select users.username users left join questions on users.id = questions.ownerid ) ");
i select questions in table questions, tags save ownerid id of owner , want username display. error:
the used select statements have different number of columns
what doing wrong?
why need union ? question table linked user , can use in join
select questions.*, tags.tagdata, users.username questions left join tags on tags.questid = questions.id left join users on users.id = questions.ownerid
Comments
Post a Comment