Jump to content

complex else


jonniejoejonson

Recommended Posts

$sql="SELECT

maxTable.maxMessageId,

a.*,

b.userFirstname, b.userLastname, b.userImage

FROM (SELECT MAX(messageId) AS maxMessageId, threadId FROM mail_messages WHERE fromUserId!='".$userId."' GROUP BY threadId) maxTable

INNER JOIN mail_messages AS a ON maxTable.maxMessageId=a.messageId

INNER JOIN users AS b ON a.fromUserId=b.userId

WHERE a.threadId='1' OR a.threadId='2'

ORDER BY a.messageId DE SC";

 

This is hard to explain... but

The point is if there is no selection from the subquery where...

fromUserId!='".$userId."'

i would like to do a differnet subquery instead..

is there a way to do this regards J.

Link to comment
https://forums.phpfreaks.com/topic/201625-complex-else/
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.