Re: SQL syntax error when trying to enter forums [message #29403 is a reply to message #29400] |
Sun, 18 December 2005 14:23 |
sommer
Messages: 21 Registered: December 2005 Location: Denmark
Karma:
|
Junior Member |
|
|
Ilia wrote on Sun, 18 December 2005 15:13 | I ment like this:
SELECT f.id, f.name, c.name, c.id, (CASE WHEN 0 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END) AS reads FROM phpgw_fud_fc_view v INNER JOIN phpgw_fud_forum f ON f.id=v.f INNER JOIN phpgw_fud_cat c ON c.id=v.c LEFT JOIN phpgw_fud_msg m ON m.id=f.last_post_id LEFT JOIN phpgw_fud_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id
|
Oh - I see...
In that case I get this error-message:
Error
SQL query: Documentation
SELECT f.id, f.name, c.name, c.id, (
CASE WHEN 0 < m.post_stamp
AND (
fr.last_view IS NULL
OR m.post_stamp > fr.last_view
)
THEN 1
ELSE 0
END
) AS reads
FROM phpgw_fud_fc_view v
INNER JOIN phpgw_fud_forum f ON f.id = v.f
INNER JOIN phpgw_fud_cat c ON c.id = v.c
LEFT JOIN phpgw_fud_msg m ON m.id = f.last_post_id
LEFT JOIN phpgw_fud_forum_read fr ON fr.forum_id = f.id
AND fr.user_id =2
ORDER BY v.id
LIMIT 0 , 30
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'reads FROM phpgw_fud_fc_view v INNER JOIN phpgw_fud_forum f ON f . id = v . f IN' at line 1
Very curious to see what you think about that.
/Henrik
|
|
|