diff --git a/anki/tags.py b/anki/tags.py index 229903a72..4d36bb0bd 100644 --- a/anki/tags.py +++ b/anki/tags.py @@ -88,7 +88,7 @@ class TagManager(object): lim = " or ".join( [l+"like :_%d" % c for c, t in enumerate(newTags)]) res = self.col.db.all( - "select id, tags from notes where id in %s and %s" % ( + "select id, tags from notes where id in %s and (%s)" % ( ids2str(ids), lim), **dict([("_%d" % x, '%% %s %%' % y) for x, y in enumerate(newTags)]))