I need a query designed for MySQL translated to work for SQL Server 2005

Posted by brookmarker on Stack Overflow See other posts from Stack Overflow or by brookmarker
Published on 2010-04-10T13:03:56Z Indexed on 2010/04/10 13:23 UTC
Read the original article Hit count: 309

Filed under:
|
|
|

I've spent a whole day on this already without figuring it out. I'm hoping somebody can help me translate the following MySQL query to work for SQL Server 2005:

SELECT MAX ( messages.date ) AS maxdate,  
topics.id AS topicid, topics.*, users.*  
FROM messages, topics, users WHERE messages.topic_id  
= topics.id AND topics.user_id = users.id AND  
topics.forum_id = " . $forumid . " GROUP BY  
messages.topic_id ORDER BY maxdate DESC

$forumid is a QueryString value defined in the following VB.NET code-behind code:

forumName.Text = "<a href='ViewForum.aspx?forumid=" & row.id & "'>" & row.name & "</a>"

I'd be super grateful if u can help.

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql