SELECT end AS row_num_v_, case when @v <> _apply.PATIENT_ID then @v := _apply.PATIENT_ID else @v end AS row_num_v, _apply.ID, _apply.MEDICAL_CARD_NO, _apply.EXPERT_RESOURCE_ID, _apply.PATIENT_ID, _apply.DEPT_ID, _apply.REG_DATE, _apply.COMPANY_ID FR…