0 Replies Latest reply: Dec 7, 2016 11:11 AM by mark pratt RSS

    Group by using same table over multiple databases

    mark pratt

      I'm using the following but getting Yes and No for each account in the results. Help please!

       

      Load

          If(Max("Ordered")>'0','Yes','No') as "Checks_Ordered"

         

      Group by [DDA_Account];

       

       

      Load

          if(WildMatch("Description1",'*CHECK ORDER*','*ORDER CHECKS*'), '1','0') as "Ordered",

        "DDA_Account";

      SQL SELECT

        Description1,

          DDA_Account

      FROM

        "CURRENT".dbo."DDA_Desc"

      union

        SELECT

        Description1,

          DDA_Account

      FROM

        "X1".dbo."DDA_Desc"

      union

        SELECT

        Description1,

          DDA_Account

      FROM

        "X2".dbo."DDA_Desc"

      union

        SELECT

        Description1,

          DDA_Account

      FROM

        "X3".dbo."DDA_Desc"

      union

        SELECT

        Description1,

          DDA_Account

      FROM

        "X4".dbo."DDA_Desc"

      union

        SELECT

        Description1,

          DDA_Account

      FROM

        "X5".dbo."DDA_Desc";