dynamically generate select sql like android does.