Select functions to replace sql select statements