我的查询看起来像
SELECT а.*, m.username, m.picture, m.picture_active
FROM questions_answer AS а
INNER JOIN members AS m ON а.poster_id=m.member_id
INNER JOIN questions AS q ON q.question_id=a.question_id
ORDER BY a.postdate DESC
我收到错误:
Unknown column 'a.question_id' in 'on clause'
我不知道这是怎么回事,请帮我解决这个问题。
表questions
是
CREATE TABLE IF NOT EXISTS `questions` (
`question_id` int(9) unsigned NOT NULL AUTO_INCREMENT,
`member_id` int(9) unsigned NOT NULL DEFAULT '0',
`question` text NOT NULL,
`postdate` int(10) unsigned NOT NULL DEFAULT '0',
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`question_id`),
KEY `member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
并且questions_answer
是
CREATE TABLE IF NOT EXISTS `questions_answer` (
`answer_id` bigint(12) unsigned NOT NULL AUTO_INCREMENT,
`question_id` int(9) unsigned NOT NULL,
`poster_id` int(9) unsigned NOT NULL,
`body` text NOT NULL,
`postdate` int(9) unsigned NOT NULL,
PRIMARY KEY (`answer_id`),
KEY `question_id` (`question_id`),
KEY `poster_id` (`poster_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;