« first day (2152 days earlier)   

12:55 PM
In connection with the recent discussions around synonyms and merging I looked into queries showing questions with tagA and tagB, tagA or tagB, tagA and not tagB.
In fact, I had the first two queries for some time.
Questions that have either of the tags: data.stackexchange.com/mathoverflow/query/1689080/…
Of course, I won't be surprised if I mixed up something or if those queries are not very efficient.
 
 
5 hours later…
5:55 PM
@Martin in that query you only need one join with posttags and tags because you can do tagname in ('tag1', 'tag2'). That expands to tagname='tag1' or tagname = 'tag2'.
@Martin in the not in (select ...) you don't the join with posts because posttags already has postid and that is all you need.
the first query looks fine to me. It is an approach I would use with only two values involved. Maybe it can be done with one join but then you need a group by and having to select postids that have a count of 2 or more.
that is hardly easier
 
6:16 PM
I have edited the query on use pt2.PostId instead of the unnecessary join.
And the other query now uses IN.
Thanks for the response! (In both cases, I should probably have realized that myself. I have used IN in quite a few queries in the past.)
 

« first day (2152 days earlier)