notes on subselects and joins