2
Contributors
7
Replies
22
Views
1 Year
Discussion Span
Last Post by cereal
0

Yes, I know. Table topics and within column id exists. This error occurs.

0

Ok, can you show the full query and the create table statement? Run: show create table topics;

0

SHOW CREATE TABLE topics

+--------+-----------------------------------------------+
| Table  | Create Table                                  |
+--------+-----------------------------------------------+
| topics | CREATE TABLE `topics` ( `id` int(9) NOT NULL  |
|        | AUTO_INCREMENT, `name` varchar(24)            |
|        | CHARACTER SET utf8 NOT NULL, `closed`         |
|        | int(1) NOT NULL, `postCount` int(9) NOT NULL, |
|        | PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`),   |
|        | KEY `id_2` (`id`)) ENGINE=MyISAM              |
|        | AUTO_INCREMENT=2 DEFAULT CHARSET=latin1       |
+--------+-----------------------------------------------+

Edited by Aeonix

0
SELECT topics.id topicId,
      topics.name topicName,
      topics.closed topicClosed,
      forums.lastTopicId forumLastTopicId,
      forums.topicCount forumTopicCount,
      forums.description forumDescription
FROM forums INNER JOIN members ON forums.lastPoster = members.id

The query isn't working at all, so I tried finding if query is incorrect, but before that I need to make the query work, to figure out why it's not working, to figure out how to fix it, so I can get result, which doesn't bring the result, it brings false.

Edited by Aeonix

1

Ok, it happens because the topics table is not listed it the FROM statement, add it as a JOIN, it should fix this issue.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.