A relation between the charge density wave (CDW) instability and superconducting Tc in layered compounds