Filtering results from connectivity query

chriso0258 20 Nov, 2015
Hello,

I want to query my locations table with CC to provide a list of equipment in a particular region. So, my query looks like this:
<?php
return array('region' => '1');
?>


However, if a piece of equipment has been moved within the same region it will show up multiple times in my list and I only want to view the record with the latest move date. My date column is of the DATE type but I'm not sure that I can use the MAX() function in CC.

Is there a way to have only one of each record show up based on the max (latest) move date?

Thanks for your help.
Chris.
GreyHead 21 Nov, 2015
Hi Chris,

Please see this FAQ - I think that the Complex query section at the end wll let you do this.

Bob
chriso0258 23 Nov, 2015
Thanks for your reply Bob.

I had looked at that FAQ but was still unsure how to format the statement using MAX('date_moved'). Would it be part of the JRequest (which I'm not that familiar with). If there are some other references you can point me to that would be helpful.

Thanks again,
Chris
GreyHead 23 Nov, 2015
Hi Chris,

JRequest() is just used to get values from the PHP $_POST or $_GET arrays. Where is your date value coming from? If you turn on the CC Debugger you should see the query that is being generated now - please copy and paste that here.

Bob
This topic is locked and no more replies can be posted.