tell me the number of cols with different value in plsql?

You can unpivot your column groups to rows and do COUNT(DISTINCT ) on them. Fiddle

   count(distinct act || desc_ || ech) as cnt
  from form
  unpivot (
    (act, desc_, ech) for presta_no in (
      (act_1, desc_1, ech_1) as '1',
      (act_2, desc_2, ech_2) as '2',
      (act_3, desc_3, ech_3) as '3',
      (act_4, desc_4, ech_4) as '4'
  ) p
  group by id_form

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top