Hi @hogi ,
I don't think these will be possible in Query Builder. It is really intended to help people get started with querying databases without having to learn any SQL. It's not going to cover every possible level of complexity of SQL query.
I think you would have to learn some SQL to do this. Or change the database schema to enable the same extract with a simpler query. Or bring the tables into JMP and do the calculations and joins on JMP tables, which you could automate through scripting.
Sorry if that is not the answer that you were hoping for but maybe it helps.
Phil