1 Reply Latest reply: Nov 7, 2012 5:56 AM by Marwim RSS

    Best way to loop through multiple rows to search for a count result

    944432
      I have a script where I'm trying to find a Rollup row without any children. I have created a SQL statement to do this, but I can only input one point at a time. If the count is greater than 0 then i'm good to go. If the count is 0 then I want to know about it.

      select count (*) from (Select * From ESSBASE_FCS.Ham
      where hier_pt like (Select substr(hier_pt, 1,8)||'%' as hcy_pt
      From ESSBASE_FCS.Ham
      Where Hier_Pt = '412375....')
      And Cctr_Or_Rollup <> 'Rollup')

      What is the best way to develop a SQL script that searches through all my Hier_pt's and return everything with a count of 0, instead of manually inputing each hier_pt at a time?

      Thanks for any help.