Fixed sql select statement