Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

First Element Of Each Sorted Group In Group By Clause

$
0
0
Hi!

I need some help on this:

I have a SQL table with the following structure: ID|ID_GROUP|DATA|TSTAMP

I need to find de column DATA with the highest TSTAMP of each ID_GROUP, so I need to group by ID_GROUP, sorting by TSTAM DESC and take de first element in each group. Any help on how can I do this with CDBCriteria or something similar??

Greats!,

Daniel

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>