5 Replies Latest reply on Apr 26, 2016 3:06 PM by Ivan Young

    Subquery

    Chris Wolcott

      I am just getting started here and have built a stored procedure that retrieves that data correctly and selected it as my data source in my workbook.  PERFECT.

       

      Now I wanted to build a workbook by selected the raw tables.  Everything works fine except for the subquery in my where statement.  I can not figure out how to define it.  Could some provide some guidance?

       

      I do not want to include any downloads from users associated with the RoleId of 0.  Users may have no role, one role or multiple roles.

       

          SELECT dl.DownloadDate, dl.UserId, o.OrgNm

          FROM   FileDownLoadLog dl

          inner join Node n on dl.NodeID = n.nodeId

          inner join RegisteredUser ru on dl.UserID = ru.userid

          inner join Organization o ON ru.OrgID = o.OrgID

          WHERE dl.UserID not in (SELECT role.UserID FROM Role WHERE  RoleID = 0);