The following query will return the list of modules that are not assigned to the user 'IDusuario = 2'
SELECT Modulos
FROM Modulos
LEFT JOIN ModAsg ON Modulos.Cod = ModAsg.Cod AND ModAsg.IDusuario = 2
WHERE ModAsg.Cod IS NULL
>Hello, I have to build a query from 3 tables:
>
>Table Usuarios:
>IDusuario Nombre
>1 Charles
>2 George
>
>Table ModAsg:
>Codmodulo Idusuario
>1 1
>2 1
>3 1
>1 2
>
>
>Table Modulos:
>Cod Modulos
>1 Mymodule1
>2 Mymodule2
>3 Mymodule3
>4 Mymodule4
>
>When I use this query:
>Select Usuario.Nombre, Modulos.Modulo from Usuario, ModAsg, Modulos where Usuario.Idusuario=Modasg.idusuario and Modasg.codmodulo=Modulos.cod and Usuario.idusuario = 2
>
>It displays:
>George and Mymodule1
>
>I need now to show for george the modules that he doesn't have yet, like
>George and Mymodule2, Mymodule3, Mymodule4
>
>How can i do it?
--sb--