Building an app and members can create 'friendships' between each other. New concept, i know. When requests are made, they are entered into a table called tbl_requests. Everytime a request is made, I want to query the table and find out the last time that user requests a friend. If the person has made a request less than 2 minutes before the current request, they are going to be given a warning and told to wait. I need to query the table for the newest entry.
tbl_requests
request_id
member_id
friend_id
datetime
Basically, using the datetime field, I need to find the newest record inserted by a certain member (match on member_id)
If the member has 30 records that match on member_id, I only want the newest record.
I'm thinking I should grab all records that match on member_id, group by datetime, sort asc, then grab the top record..
better ideas?
tbl_requests
request_id
member_id
friend_id
datetime
Basically, using the datetime field, I need to find the newest record inserted by a certain member (match on member_id)
If the member has 30 records that match on member_id, I only want the newest record.
I'm thinking I should grab all records that match on member_id, group by datetime, sort asc, then grab the top record..
better ideas?
