SQL Working. Need to handle OnClick