There is this existing SE Data Explorer query: All my posts on the SE Network

The query is awesome and works great with one small flaw (IMO). It outputs a "Post ID" which is useless for me because I need a "Post Link" which can be clicked and will take you to the Answer you posted in Stack Exchange. It's important to note link to question is not needed unless it is your own question of course.

Has anyone else experienced this and modified the query?

I tried for awhile to revise the query myself but I just ended up breaking things. I can post the entire query code if necessary.

  • I was using imprecise language. I needed the Answer URL not the Post Link which has different meaning. Oct 31, 2021 at 18:29

2 Answers 2


The answer by @benisuǝqbackwards works in most cases, but not in this one as @animuson hinted at in a comment. I always attributed that to SEDE only being able to do this for the site in the URL (after data.stackexchange.com/) but apparently that is not correct :)

Anyway, since we already have the post ID and the title, we can construct the URL ourselves if we have the base URL of the site. I've described a procedure for this in another Meta Stack Exchange answer. The resulting query can be found here. As a bonus, the URLs end up in the CSV download as well - this is not the case for the regular use of [Post Link].

enter image description here

  • Almost there :) The link generated: https://askubuntu.com/q/1336610|How to upload a file to google drive? doesn't work when pasted into the browser address bar. It gets "404". It needs to be: https://askubuntu.com/a/1336610/307523 which is the answer I posted. I see what you mean about splitting of "|Title" because the title is already a column in the query and doesn't need to be repeated. Oct 31, 2021 at 16:20
  • 1
    @WinEunuuchs2Unix why would you paste the link in the browser? Can't you just click it in the results grid?
    – rene
    Oct 31, 2021 at 16:49
  • @rene the design of my website shows the Stack Exchange Answer but also provides a link: [See original Answer on SE](Post Link) so I need a REAL url link for Post Link. It probably doesn't help but here is my program: github.com/pippim/pippim.github.io/blob/main/stack-to-blog.py Oct 31, 2021 at 17:26
  • @WinEunuuchs2Unix right, I've modified the query a little bit to give the real URL.
    – Glorfindel Mod
    Oct 31, 2021 at 17:37
  • @Glorfindel It works perfectly now. Sorry for using misleading "Post Link" instead of "URL" in the first place. Oct 31, 2021 at 18:21
  • I've spent weeks developing a python program and website around your query. Thank you very much! I gave you credit of course. One last question if I may, I'd like to know my questions that I never answered myself. Not sure if that information is already in the query? The reason I ask is I do ask questions that I answer myself but in that case the answer is important and the question is cast aside. Nov 24, 2021 at 1:33
  • @Glorfindel Disregard last request. I solved the problem programmatically in python by matching the title of question to title of answers. In the process I found 59 self answered questions I had forgot to accept after 2 day waiting period! Nov 25, 2021 at 12:31
  • @WinEunuuchs2Unix great. I forgot about your request (I get a lot of pings) and anyway I don't feel comfortable making such large changes in a query I didn't write.
    – Glorfindel Mod
    Nov 25, 2021 at 15:18

If you alias an ID as [Post Link] then you'll get a link, as long as it's a genuine ID. For example:

select top 1 id as [Post Link]
  from Posts
  • Can you show the line after this code block is inserted and the line before this code block is inserted within the original link:data.stackexchange.com/stackoverflow/query/1407382/… IE I have no idea where to insert those two lines... Oct 31, 2021 at 0:28
  • 4
    This method may not work with the particular query linked in the question due to its use of sub-queries. Even if you could get it to work, it'd probably time out since the final results being returned are not coming from the Posts table, but an arbitrarily created Results table, so SEDE would attempt to perform another lookup in Posts for every single result.
    – animuson StaffMod
    Oct 31, 2021 at 0:50

You must log in to answer this question.

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