cakephp中的复杂子查询

时间:2014-03-19 13:20:24

标签: php mysql sql cakephp-2.0

我有下面提到的SQL查询,我想用cakephp格式。我是cakephp的新手。

SELECT Message.*, conversations.*, 
     (select concat(sAsset_FileName,'__',sAsset_ThumbImageName) 
     from message_assets 
     where nAsset_ForContentType=2 
       AND nAsset_ContentID=conversations.nMessageConversationID) as sAsset_FileName  
FROM `message` AS `Message` 
LEFT JOIN `message_conversation` AS `conversations` 
 ON (`conversations`.`nMessageID`=`Message`.`nMessageID`)
WHERE `Message`.`nMessageID` = 1

请帮帮我。

0 个答案:

没有答案