Jump to content

Max() Error, Why?


JohnOP

Recommended Posts

I'm re doing my private message system and im watching a video tutorial on it but have got this very strange error with the max() function

 

code

<?php
$sql = "SELECT `conversations`,`conversation_id`,
                         `conversations`,`conversation_subject`,
                  MAX(`conversations_messages`,`message_date`) AS `conversation_last_reply`
		  FROM `conversations`
		  LEFT JOIN `conversations_messages` ON `conversations`,`conversation_id` =                                    `conversations_messages`,`conversation_id`
		INNER JOIN `conversations_members` ON `conversations`,`conversation_id` = `conversations_members`,`conversation_id`
		WHERE `conversations_members`,`user_id` = {$id}
		AND `conversations_members`,`conversation_deleted` = 0
		GROUP BY `conversations`,`conversation_id`
		ORDER BY `conversation_last_reply` DESC";

 

All the fields and tables are correct and i get this error

 

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 '`message_date`) AS `conversation_last_reply` FROM `conversations` LEFT J' at line 3
Link to comment
https://forums.phpfreaks.com/topic/254952-max-error-why/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.