-1

For example, create two related tables:

create table tableA(id int identity primary key not null, columna2 varchar(10), columna3 varchar(10))
create table tableB(id int identity foreign key references tableA not null, columnaB varchar(10), columnaC varchar(10))

And then perform the join:

select *from tableA a inner join tableB b on a.id=b.id

How to avoid that the column id does not appear twice since they will have the same data assuming that the tables have many more columns and specifying column by column is not what you want.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
CALEB
  • 1
  • 1
  • 1
    I'm voting to close this question as unclear, because it is not written in English and this is an English language site. You may want to visit http://es.stackoverflow.com instead. – Ken White Jun 19 '17 at 01:41
  • 2
    Possible duplicate of [SQL inner join query returns two identical columns](https://stackoverflow.com/q/7157891/608639) and [Duplicate columns with inner Join](https://stackoverflow.com/q/19863132/608639) – jww Jun 19 '17 at 01:54

1 Answers1

1

You must write all column name of two tables. I hope it will help you.

select
 a.id
,a.columna2
,a.columna3
,b.columnaB
,b.columnaC
from tableA a inner join tableB b on a.id=b.id
Tien Nguyen Ngoc
  • 1,555
  • 1
  • 8
  • 17
  • es exactamente lo que pregunto si se puede hacer de otra forma porque si por ejemplo en cada tabla hay 20 columnas no hay una manera de no escribir específicamente columna por columna las 39 columnas – CALEB Jun 21 '17 at 01:47
  • Can you write in English? I don't understand. – Tien Nguyen Ngoc Jun 21 '17 at 01:51