Cant Get Joins to work

  • Hello, i'm developing an application and i'm stuck, here is the problem, one part of the application creates employees with their respective knowledge and skill on that knowledge, so one person could have "sql development" skill "intermediate" and another "sql development" skill "expert". The problem comes when i try to query data, for many knowledges and skills. You could want to know about people that have one knowledge or anotes with certain skills (sql expert or sql intermediate and windows certified). I have a Skills table (skillname, skillid), knowledges table (knowname,knowid), employee (name,id), lets say you want all that together, how could you accomplish that ?? I tried intersect, but as fields from tables differ its not working, and my inner joins do not seem to work. Appreciate any help!

    Hernan

  • Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Ok, im sorry, here is everything:

    Table Definition: (nivel = skill , conocimiento = knowledge)

    [EMPTBL_CONOCIMIENTOEMPLEADO]

    [IDEmpleado] [int] NOT NULL,

    [IDConocimiento] [int] NOT NULL,

    [IDNivel] [int] NOT NULL,

    [IDEMPCON] [int] IDENTITY(1,1) NOT NULL

    [EMPTBL_EMPLEADOS]

    [PNombre] [nvarchar](50) COLLATE Latin1_General_CI_AI NOT NULL,

    [SNombre] [nvarchar](50) COLLATE Latin1_General_CI_AI NULL,

    [Apellido] [nvarchar](50) COLLATE Latin1_General_CI_AI NOT NULL,

    [DNI] [nvarchar](50) COLLATE Latin1_General_CI_AI NOT NULL,

    [CUITL] [nvarchar](50) COLLATE Latin1_General_CI_AI NOT NULL,

    [NROLEGAJO] [nvarchar](max) COLLATE Latin1_General_CI_AI NOT NULL,

    [IDPuesto] [int] NOT NULL,

    [IDArea] [int] NOT NULL,

    [FechaIngreso] [datetime] NOT NULL,

    [FechaEgreso] [datetime] NULL,

    [FechaNacimiento] [datetime] NOT NULL,

    [IDProyectoActual] [int] NULL,

    [SEXO] [nvarchar](50) COLLATE Latin1_General_CI_AI NULL,

    [IDEmpleado] [int] IDENTITY(1,1) NOT NULL

    [GENTBL_NIVELES]

    [Nivel] [nvarchar](50) COLLATE Latin1_General_CI_AI NOT NULL,

    [IDnivel] [int] IDENTITY(1,1) NOT NULL

    [GENTBL_CONOCIMIENTOS]

    [NOMBRE] [nvarchar](50) COLLATE Latin1_General_CI_AI NOT NULL,

    [DESCRIPCION] [nvarchar](max) COLLATE Latin1_General_CI_AI NULL,

    [IDCONOCIMIENTO] [int] IDENTITY(1,1) NOT NULL

    Desired Output

    EMPTBL_EMPLEADOS.APELLIDO, GENTBL_CONOCIMIENTOS.NOMBRE, GENTBL_NIVELES.NIVEL

    Sample Result : (Filtering people that know windows and SQL with any skill)

    Ruggiano SQL Intermediatte

    Ruggiano WIndows Expert

    Smith SQL Expert

    Smith Windows Begginer

    As i said before, my main problem is that i dont know how to filter this stuff, the only thing i can think of is intersect...

    Thanks in advance

    Hernan

  • Still need the sample data.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply