I have a table with userid, attribute_name, value_date_time. I want to report a single row for each user that shows the latest entry in the table based on the timestamp inserted into value_date_time. Any help much appreciated.
You'll have to query for the maximum date attribute and then use that to select the record that matches it. Something similar to the following:
FROM table_name t1, (SELECT t2.userid,t2.attribute_name,
MAX(t2.value_date_time) as max_time
FROM table_name) t2
WHERE t1.userid=t2.userid AND t1.attribute_name=t2.attribute_name
AND t1.value_date_time = t2.max_time;
This Content Component encountered an error
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.