Santosh Sasupalli

Santosh Sasupalli

  • 1.5k
  • 181
  • 23.1k

join tables in sql server

Sep 17 2016 11:14 AM
i have 2 tables
base:
 
Id int
Name Varchar 
 
and values in base:
 
1 abc
2 cde
3 def
 
Sub:
sid int
CreatedBy Id(From base table Id)
ModiFiedBy Id(From base table Id)
 
and values in sub
1  2   3
2 1 2
3 3  2
now i want table like this
sid   CreatedBy  CreatedByName   ModifiedBy ModifiedByName
1        2                  cde                         3                    def
2         1                 abc                          2                    cde
3         3                def                            2                       cde 
 
how to write this query please help me
 
 

Answers (4)