fix sql ambigurous issue