In the Data Explorer, how do I find the questions I have asked, which are answered but not accepted by me?
In search, I could do something like:
hasaccepted:0 user:id answers:1
I am looking for a similar Data Explorer query.
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.
Sign up to join this communityIn the Data Explorer, how do I find the questions I have asked, which are answered but not accepted by me?
In search, I could do something like:
hasaccepted:0 user:id answers:1
I am looking for a similar Data Explorer query.
As mentioned in the comments it's a pretty straight forward query. That said there are some things we should know that can make this eaiser
Using the above I constructed the following query
With Questions as (
Select
a.id ,
a.Score,
RANK() OVER(PARTITION BY q.id ORDER BY a.score desc) rk
From
posts q
INNER JOIN posts a
ON q.id = a.ParentId
Where q.OwnerUserID = ##UserId##
And q.acceptedanswerid is null
And a.Score >= ##MinAnswerScore:Int?0##
)
Select
id [Post Link],
Score
From Questions
Where
rk = 1
Notes
FROM posts q INNER JOIN posts a ON q.id = a.ParentId
ensures that all posts q
are's questions that have at least one answerRANK() OVER(PARTITION BY q.id ORDER BY a.score desc) rk
combined with where rk = 1
returns only the highest scored answers with the query. In case of ties for highest more than answer will be returned. (If you want only one change rank()
to row_number()
)When run for you with a minimum of 5 here are the results
Post Link Score
------------------------------- -----
Converting variable to integer 5
replace space in URL JavaScript 6
escape single quotes 19