add having cluase

add having cluase