Join Within table's Column

akhter hussain 3,001 Reputation points

i want to join column within table ,below is data

Create table #Concategory (Cat_ID int,Cat_name varchar(50),Port_ID int,Acc_type varchar(50))  
insert into   #Concategory values (1,'Akhter','','Port')  
insert into   #Concategory values (2,'Karchi','','Port')  
insert into   #Concategory values (3,'Pakistan',1,'Location')  
insert into   #Concategory values (4,'Iran',2,'Location')  
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
9,856 questions
{count} votes

Accepted answer
  1. Erland Sommarskog 78,581 Reputation points MVP

    Now i have change Port_ID=1 from 1 to 2

    Then it makes more sense.

    SELECT b.Cat_ID, b.Cat_name, a.Cat_name AS Port_Name
     FROM   #Concategory a
     JOIN   #Concategory b ON b.Port_ID = a.Cat_ID
    0 comments No comments

0 additional answers

Sort by: Most helpful