Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | laurillo87Starting Member
 
 
                                        4 Posts | 
                                            
                                            |  Posted - 2014-10-01 : 10:06:06 
 |  
                                            | Hello,Here is my problem, i try to do a query with two tables, MKTG_USER and MKTG_REQUERIMIENTOS.my inner join is MKTG_USER ON MKTG_REQUERIMIENTOS.ID_USER = MKTG_USER.ID_USUARIO AND MKTG_REQUERIMIENTOS.ID_CLIENTE = MKTG_USER.ID_USUARIOand that dont get any data, in MKTG_USER.ID_USUARIO is PK, MKTG_REQUERIMIENTOS.ID_USER is FK and MKTG_REQUERIMIENTOS.ID_CLIENTE is FKthe RS of Tables is here  [url]http://imageshack.com/f/hjKyYVm9p[/url]Hope can help me. |  |  
                                    | djj55Constraint Violating Yak Guru
 
 
                                    352 Posts | 
                                        
                                          |  Posted - 2014-10-01 : 11:47:02 
 |  
                                          | The only way this will return anything is if MKTG_REQUERIMIENTOS.ID_USER = MKTG_REQUERIMIENTOS.ID_CLIENTEIf MKTG_USER is to be used for two different reasons then it would need to be linked twicedjj |  
                                          |  |  |  
                                    | laurillo87Starting Member
 
 
                                    4 Posts | 
                                        
                                          |  Posted - 2014-10-01 : 12:04:07 
 |  
                                          | quote:thank you djjure right, i linked twice, there is a the solutionSELECT T2.NOM_USUARIO Vendedor, T3.NOM_USUARIO Cliente  FROM MKTG_REQUERIMIENTOS T1INNER JOIN MKTG_USER T2 ON T2.ID_USUARIO = T1.ID_USER INNER JOIN MKTG_USER T3 ON T3.ID_USUARIO = T1.ID_CLIENTE Here is the query resultVendedor    ClienteLuis         FabiolaOriginally posted by djj55
 The only way this will return anything is if MKTG_REQUERIMIENTOS.ID_USER = MKTG_REQUERIMIENTOS.ID_CLIENTEIf MKTG_USER is to be used for two different reasons then it would need to be linked twicedjj
 
 |  
                                          |  |  |  
                                |  |  |  |