[Solved] Is there a way of joining 2 tables and verify the data they have


You need to revisit your table design for sure.

I am not very clear what you are looking for, but i feel that you are looking for entires in the derived table for which one or more values are null. For this scenario you can write query like following.

   select distinct mt.mainid from maintable mt
    inner join derivedtable m on mt.mainid=m.id and m.name="MainId"
    inner join derivedtable u on mt.mainid=u.id and u.name="UserId"
    inner join derivedtable r on mt.mainid=r.id and r.name="RoleId"
    where (m.value is null or u.value is null or r.value is null)

solved Is there a way of joining 2 tables and verify the data they have