News for hackers. Stuff that matters.
Re:MongoDB Is Abusing JSON by trowftd on Friday January 18, 2013 @02:18AM (#5077547)
I'm not sure what you mean, but the parent's SQL is valid and returns the same data as the gp's, only in a more efficient manner. No need to do three inner joins when you can get away with one.

In fact, you can take out the second part of the inner join condition and move it in the where clause, like this (execution plan will stay the same):

  SELECT posts.* FROM posts
  INNER JOIN post_tags pt ON pt.post_id = posts.id 
  WHERE posts.author IN ('Joe', 'Jane') AND pt.tag IN ('foo', 'bar', 'baz')
  ORDER BY post_date DESC;
Re:MongoDB Is Abusing JSON by cheald on Friday January 18, 2013 @02:49AM (#5077620)
The query is for posts tagged with all three tags, not just any one of them.