Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your query (as written) is looking for the number of projects that have been created in the last 30 days have have attached comments/feedback, and the person in question has commented on this project. </p> <p>The first thing that stands out is that you're checking the date the projected was created, not the date of the comments/feedback. If you do this, when the project becomes more than 30 days old, no more feedbacks will count when running the query. You most likely will want to add a timestamp to the feedbacks table and check that field instead.</p> <p>Also, you're doing a count of the number of projects, rather than the number of feedbacks that meet the criteria. </p> <p>For you're query, I would try something like:</p> <pre><code>SELECT COUNT(feedbacks.id) FROM feedbacks, projects WHERE projects.id = feedbacks.project_id AND projects.status IN (5, 10) AND feedbacks.timestamp &gt;= DATE_SUB('2010-12-17 21:24:51', INTERVAL 30 DAY) ORDER BY projects.id </code></pre> <p>This will find the number of feedbacks per each project (of the given status). If you want to count only the feedbacks that were given by the person who won the bid, you can add to the WHERE clause:</p> <pre><code>AND feedbacks.from in ( SELECT project_bids.bid_owner_id FROM project_bids WHERE project_bids.accepted = 1 AND project_bids.project_id = projects.id ) </code></pre> <p>Your English is a bit difficult to understand, so please clarify I misunderstood something.</p> <p><em>Note to everyone else: I'm still trying to get used to the Mark Down system. Feel free to correct my formatting above.</em></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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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