Is there a query to know how many questions received answers before they are put on hold and I am one of the users who wrote an answer before the question is closed?

If it looks confusing, let me explain. For example, you write an answer for a question. Later, the question gets closed as duplicate or too broad or any other reason. Take a look at this question

Time for some more swag!

It was open for a limited period of time but closed later. It received 129 answers in the mean time. Similarly, if I want to find such questions which were open when I wrote an answer and later closed, is there a Data Explorer query? I have gone through search operators in the help center and tried closed:yes is:a user:me but it returns closed questions asked by me. Is there a tip I am missing?

Is there a query for returning intended input?


Here is similar query to the other answer, but it also includes the questions which were closed and later reopened (not only the one which are still closed).

Questions answered by a user before they were closed

  FROM PostHistory AS ph
    ON a.ParentId = ph.PostId
   AND a.CreationDate < ph.CreationDate 
   AND ph.PostHistoryTypeId=10
  WHERE a.OwnerUserId = ##UserId:int##

This does not include deleted posts - SEDE stores only some information on deleted posts (in the PostsWithDeleted table), author of the post is not among them.

| improve this answer | |

Yes, there is now.

I've got five answers by you on Meta Stack Exchange which qualify:

enter image description here

The query looks at questions which are currently closed; if they have been reopened in the meantime, they will not appear in the results.

After a request by Sonic, the query now also tells you if the answer would have qualified for the Explainer / Refiner / Illuminator badge, or why not: answers on closed questions don't count for those badges.

| improve this answer | |
  • Can you please add another column for whether the answer would qualify for the Explainer/Refiner/Illuminator badge series had the question been open? (If the question later gets closed at any point, the answer ceases to qualify.) – Sonic the K-Day Hedgehog Aug 17 '19 at 18:13
  • I never realized that; the query has now been updated. – Glorfindel Aug 18 '19 at 7:22

You must log in to answer this question.

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