I'm pretty new to MySQL, so this probably is an easy question for experienced people, but I just can't figure this out. I need to get items from database where user has posted a comment, and there is newer comment by someone else.
My table has these collumns
app_id - id of the item
app_comment - comment blank if rate is present
app_rate - rating blank if comment is present
date - date of posting
device_id - unique id to identify each user.
I have written simple query to get each comment the user(device_id) has posted on.
temp table:
SELECT `app_id` FROM `appaction` WHERE `device_id` = '00000000-5a24-5a06-0000-00005c907706' AND `app_comment` <> ''
But can't figure out what to do next. Now I somehow need to get only those app_id from main table where somebody else(different device_id) has a newer post on each of these items
Update: Data example: http://www.sqlfiddle.com/#!2/8d986/1
Note: that this is just sample to get the idea how the table looks. In reality it has about 10 000 values inside.
for example: I'm giving out device_id to php script, and in the output I want all app_id where user has posted himself and there is newer comment after his.
Input sample: http://www.sqlfiddle.com/#!2/66258/1
Desired output is for input ffffffff-c565-9b4a-ffff-ffffc9d821fd
img/Honda/AccordPICS/4167946157_a5b77093bc_b.jpg
because there is newer post for this app_id by somebody else.