SQL - Join Two Tables About The Same Entities -


i have created 2 tables, each table contains entries same entity. how can write query join entries , create unified entry in table?

sorry confusion guys. should provide simple example.

my 2 tables similar below,

table 1: name, id, email, city, state, phone
table 2: lastname, firstname, email, gender, id

i assume id primary key links 2 tables. query takes selected columns each table , inserts them table @u3.

 declare @u3 table(id int, firstname varchar(50), lastname varchar(50),                     city varchar(50), [state] varchar(50), phone varchar(50),                   email varchar(50), gender varchar(50))  insert @u3   select u1.id, u2.firstname, u2.lastname, u1.email,          u1.city, u1.state,u1.phone, u2.gender   table1 u1      join table2 u2 on u2.id=u1.id  select * @u3  

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -