I am trying to show only one (the last added record) in a child table. To make it a little more specific, here is the setup: Mastertable -> ChildTable, linked via AccountNr. When I go to the Child Table, I only want to show the last entry for the Account. I tried to use the following customized SQL Query, but it does not appear to work:
select `ID`,
`Account_Number`,
`Date`,
`Amount`
From `Customer_Payments`
ORDER BY 'Date' DESC
LIMIT 1
How can I achieve that ? Any help is as usual greatly appreciated.
=============================================
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I think I fixed it myself I just went into the generated source and chenged this section
$numrows=GetRowCount($strSQL);
if($numrows)
{
//$maxRecords = $numrows;
//$maxpages=ceil($maxRecords/$nPageSize);
//if($mypage > $maxpages)
// $mypage = $maxpages;
//$maxrecs=$nPageSize;
$strSQL.=" limit 1";
//$strSQL.=" limit ".(($mypage-1)*$nPageSize).",".$nPageSize;
}
But now the calculated totals (Amount) only shows the last amount, too.... I would like for it to still calculate the totals for that customer, regardless of how many rows are displayed.... how can I best do that ?