Value reference default OPD from visit_attribute table on any visit type like Emergency, Pharmacy,IPD and so on.

Issue on value reference data from visit_attribute as any visit started with registartion default to OPD value reference. We have built the query of patinet visit type data with visit_attribute for reporting and getting issue on patient count on the basic of value reference from table visit_attribute. @angshuonline any solution for this?