@Martin Ah, thanks, that's a nice copy-and-pastable block to calculate hostname and kind of confirms that there's no cleaner way to do it.
I'm sure I have written queries that do something a bit like it before, but the reason I need this now is that my account got accidentally deleted by SE (long story) and I was using SEDE queries to try to track what I had before. So I also can't find my own old queries easily :-)