Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL query inside query
    primarykey
    data
    text
    <p>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.</p> <p>My table has these collumns</p> <pre><code>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. </code></pre> <p>I have written simple query to get each comment the user(device_id) has posted on.</p> <pre><code>temp table: SELECT `app_id` FROM `appaction` WHERE `device_id` = '00000000-5a24-5a06-0000-00005c907706' AND `app_comment` &lt;&gt; '' </code></pre> <p>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 </p> <p><strong>Update:</strong> Data example: <a href="http://www.sqlfiddle.com/#!2/8d986/1" rel="nofollow">http://www.sqlfiddle.com/#!2/8d986/1</a></p> <p>Note: that this is just sample to get the idea how the table looks. In reality it has about 10 000 values inside.</p> <p>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.</p> <p><strong>Input sample:</strong> <a href="http://www.sqlfiddle.com/#!2/66258/1" rel="nofollow">http://www.sqlfiddle.com/#!2/66258/1</a></p> <p><strong>Desired output</strong> is for input ffffffff-c565-9b4a-ffff-ffffc9d821fd</p> <p>img/Honda/AccordPICS/4167946157_a5b77093bc_b.jpg</p> <p>because there is newer post for this app_id by somebody else.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload