Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

join two diff tables

$
0
0

hi

In the below query the Name is in Table2 and Dept is in Table1, in such case how to alert the below query

in table1 Name = table2 empname

SELECT m1.Name,
       ( SELECT left(m2.Dept,1)+ '/'
           FROMTable1 m2
          WHERE m2.Name= m1.Name
                      FOR XML PATH('') ) AS Dept_Group
  FROMTable1 m1
 GROUP BY m1.Name;



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>