2 Replies Latest reply on Oct 8, 2017 11:21 AM by cscoengineer

    HELP WITH SQL AND REPORT WRITER

    asafsqlhelp

      Hello guys.

       

       

      I Have ZERO SQL experience so anyone's help will be greatly appreciated.

       

      I need to add on my reports Region

       

      SELECT DISTINCT

        ahv.Name 'Alert Name'

        ,ahv.RelatedNodeCaption 'Parent Device'

        ,ahv.EntityCaption 'Alert Object'

        ,ISNULL(lastOne.Qty,0) 'Last 1 Day'

        ,ISNULL(lastSeven.Qty,0) 'Last 7 Days'

        ,ISNULL(lastThirty.Qty,0) 'Last 30 Days'

      FROM AlertHistoryView ahv

       

      How do I do it PLEASE?

      Thanks in advancce to all of you that might help me/ save me

        • Re: HELP WITH SQL AND REPORT WRITER
          I LIKE EGGS

          Hey,

           

          i can try helping, made me chuckle (save me). is your region a custom property ?  is there anymore to the SQL?  something updating the value LastOne.Qty,?

          • Re: HELP WITH SQL AND REPORT WRITER
            cscoengineer

            You need to join it to the nodes tables to pull custom properties (or other node related information)

             

            SELECT DISTINCT

              ahv.Name 'Alert Name'

              ,ahv.RelatedNodeCaption 'Parent Device'

              ,ahv.EntityCaption 'Alert Object'

              ,ISNULL(lastOne.Qty,0) 'Last 1 Day'

              ,ISNULL(lastSeven.Qty,0) 'Last 7 Days'

              ,ISNULL(lastThirty.Qty,0) 'Last 30 Days'

               ,n.location [location]  -- or any other custom property

            FROM AlertHistoryView ahv

            join nodes n on n.nodeid=ahv.relatednodeid