changed ExecSQL queries and added select for portfolio