Is there any way to search for questions that have a specific tag and only that lonely tag?

In other words, I'd like to be able to do something like the following to find questions that have a single tag and no other:

[mytag] tagcount:1

This would be very useful for tag cleanup situations to be able to do house-cleaning before nuking a tag.


4 Answers 4


I took the query in this other answer and cleaned it up a bit, making it more generic:

Select Top 5000 Id As [Post Link], CreationDate
From Posts
Where Tags = Lower('<##Tag##>')
Order By CreationDate Desc

SEDE query.

  • where title is not null? I hope you meant where posttypeid = 1
    – rene
    Mar 31, 2016 at 10:40
  • @rene lol, as I said I just took existing query which worked, and just cleaned it up a bit. I'm pretty sure that if doing it from scratch, would have used the elegant way of checking the post type value. :) Mar 31, 2016 at 11:49

This query might help...


It is specifically for Programmers but you can use it to search for questions with only a specific tag.

  • 1
    That's awesome, but the data explorer doesn't include beta sites!
    – Caleb
    Oct 1, 2012 at 13:19
  • @Caleb Yeah and the information is generally not updated frequently, as this is not production data. It is really only useful if you were curious for analytical reasons. Oct 1, 2012 at 13:22
  • 1
    I'm trying to do tag cleanup, so it would be nice it was actually live data so I could see progress as I re-tag things. +1 for a tangentially helpful bit though.
    – Caleb
    Oct 1, 2012 at 13:23
  • Also, welcome to Meta.SO! I feel honored to catch your first post ;)
    – Caleb
    Oct 1, 2012 at 13:23
  • @Caleb Thanks for the welcome! Been lurking for a while, don't feel compelled to discuss things often. Oct 1, 2012 at 13:30
  • 3
    @Caleb it include beta sites now. Enjoy! Jan 29, 2014 at 8:38

Using the API, you can find all questions that have a certain tag, then filter out the ones that have more than one tag. Here is a demonstration that searches for questions tagged solely with on Bicycles:

var tag = "puncture";
var site = "bicycles";

var url = 'http://api.stackexchange.com/2.1/questions?sort=activity&callback=?';

var h3 = $('h3 span');

// Retrieve data
(function gather(cp, object) {
    if (typeof object === "undefined" || object.has_more) {
        $.getJSON(url, {
            site: site,
            tagged: tag,
            page: ++cp,
            key: "awn3X8U)9erzSfhBhqSF4A((",
            filter: "!BGS1(RNaQD-DYnwoUQeh2eZDaLm__P"
        }, function (data) {
            h3.html("(" + cp + " pages)")
            if (object) {
                data.items = data.items.concat(object.items);
            gather(cp, data);
    } else {

// Display data
function display(data) {
    var data = data.items;
    data = data.filter(function (v, i, A) {
        return v.tags.length == 1;
    $.each(data, function (i, v) {
        var li = $('<li/>');
        var a = $('<a/>').attr('href', this.link).text(this.title);
    var heading = $('<h3/>').html('Total: ' + data.length);

Fwiw, if you want to find any question with just one tag, regardless of the tag, you can use a query like this:

  Id [Post Link], Tags, *
  LEN(Tags) - LEN(REPLACE(Tags, '<', '')) = 1 -- # of <'s = # of tags
  CreationDate DESC

An alternate trick in the case of just one tag is Tags NOT LIKE '%><%'.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .