Select o.* from (
Select max(updated_at) as maxdate, sender_user_id, recipient_user_id
from chattable
group by sender_user_id, recipient_user_id
) as t
join chattable as o on t.sender_user_id=o.sender_user_id and t.recipient_user_id=o.recipient_user_id and t.maxdate=o.upadet_at
<input type="button" id="magicbtn" />
<div id="magichtml"></div>
<script>
$(document).on("click", "#magicbtn", function() {
$.ajax({
url: "/ajax/magic.php"
}).done(function(result) {
$( "#magichtml").html(result);
});
});
CModule::IncludeModule("iblock");
$res = CIBlockElement::GetList(
Array("NAME" => "ASC"),
Array("IBLOCK_ID" => 8, "ID" => 5346),
false,
false,
Array(
'ID',
'NAME',
'PROPERTY_MANUFACTURER.PROPERTY_TESTLINK',
)
);
while ($item = $res->GetNext())
{
echo '<pre>';
print_r($item);
echo '</pre>';
}