sql - Complicated mysql query across two tables -
table 1: invtypes columns typeid,groupid,typename,description
table 2: item_value columns typeid,volume,avg,max,min,stddev,percentile,updated_on
i need return of above columns latest updated_on (datetime) field deciding factor. return latest datetime each day of information table 1 , table 2 result.
this how rows corresponding recent updated_on each date in item_value table:
select invtypes.*, item_value.* item_value inner join ( select max(updated_on) `updated_on` item_value group date(updated_on) ) latest on latest.updated_on = item_value.updated_on inner join invtypes on invtypes.typeid = item_value.typeid order item_value.updated_on
Comments
Post a Comment