construct sql with implode