0

Possible Duplicate:
Inner and left join on the same tables

I currently have this statement

SELECT A.*, B.* FROM A a INNER JOIN B b ON A.x = B.x

However, A and B both have a second commonly named column: y. I'd like to only have the y column from A (exclude the one from B), without removing the A.* and B.* parts (many other columns in each table that may or may not always be there). Is this possible?

Example

A

x  y  
0  3
1  4
2  5

B

x  y
0  8
1  null
9  7

result

x  y
0  3
1  4
Community
  • 1
  • 1
Andrew
  • 2,519
  • 6
  • 29
  • 46

1 Answers1

0

Take a look at SQL exclude a column using SELECT * [except columnA] FROM tableA? Second answer. Not the best solution, but you can use this as a workaround. In general, you should specify the full list of columns explicitly.

Community
  • 1
  • 1
Artur Udod
  • 4,465
  • 1
  • 29
  • 58