Join data from two pages into one table

I found myself yesterday in a situation where I wanted to list in a table data properties scattered over two wiki pages for each row. That is, given one table row, one column was found on one page, while the other column was found on another page. After asking on #semantic-mediawiki, faceface explained me how to do this, and to write it up here. The key here is to use templates.

The templates (the crucial part below) create the table. The main template part uses a #show statement to get the SIO_0003000 property from the second page: #show: {{{2}}} | ? SIO 000300. The first page is what is being queried for with #ask: [ [ HasPKaValue::+ ] ].