|
Posted by Oli Filth on 11/18/87 11:42
frizzle said the following on 15/03/2006 16:28:
> The query is below, and the error looks like this:
> You have an error in your SQL syntax near 'SELECT t.`id` FROM
> `ne_topics` t WHERE t.`' at line 12
>
> SELECT n.`id`, n.`published`, n.`title`, n.`url`, n.`body`,
> COUNT(f.`id`) AS 'fullbody',
> COUNT(c.`id`) AS 'no_of_comments',
> u.`screenname`, u.`email`
> FROM `ne_topics` n
> LEFT JOIN `ne_fulltopic` f
> ON (f.`id` = n.`id`)
> LEFT JOIN `ne_comments` c
> ON (c.`topic_id` = n.`id`)
> LEFT JOIN `gl_users` u
> ON (u.`id` = n.`author_id`)
> WHERE n.`id` IN( SELECT `id`
> FROM `ne_topics`
> WHERE `visible` = 1
> AND `published` <= NOW()
> ORDER BY `sticky` DESC, `published` DESC
> LIMIT 12 )
> GROUP BY n.`id`"
>
Are you sure that's the error that corresponds to this query? Because
you don't have anything called "t" in your query, and nothing in your
query matches the syntax referred to in the error message...
BTW, it's not necessary to back-tick (`) every field name in the query,
and it makes it quite hard to read. Also, your aliases ("fullbody" and
"no_of_comments") are quoted in single-quotes, which I is wrong, I think.
--
Oli
[Back to original message]
|