simplyfied query_cd()