[3.8] Fix sql to get created client apps