PDA

View Full Version : Convert sql -> Mysql


Ewoud
04-09-2003, 03:30 PM
Hi

i have a table 'forum' with
id - topic - user - datum - comment

What i want is a table with only the max date with the corresponding user grouped by the topics
so i can set the last message was post on ... by ...

i found the solution in SQL:
SELECT topic, user, datum
FROM forum t1
WHERE datum = (
SELECT MAX( datum )
FROM forum
WHERE topic = t1.topic
)
But this give a Syntax error in MySQL

Can someone convert it?
Or does anyone know the solution?

Thx,

raf
04-09-2003, 04:20 PM
You can only use subquerys (or "subselects") from MySQL versio 4.1 on.

http://www.mysql.com/doc/en/ANSI_diff_Sub-selects.html