Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

Join table

Good morning,
Ive done this before, but cant remember how Ive done it.

Ive for 2 tables with the same field name, but with different values in, Id like to create a query which displays all rows from one table, and in the same coloum the data from the second.

The coloum name is 'sqlOut' and the tables are imaginativly called 'table1' and 'table2', I thought I could just use join, but I dont have anything to join onto.

Any suggestions?

Thank you
Avatar of kaminda
kaminda
Flag of Sri Lanka image

You could use UNION ALL to do this
SELECT sqlOut FROM Table1 
UNION ALL
SELECT sqlOut FROM Table2

-- Also you can use UNION which will eliminate any duplicates in the final result

SELECT sqlOut FROM Table1 
UNION
SELECT sqlOut FROM Table2

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Om Prakash
Om Prakash
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
malikirfan28:

Its a pain when you post the same answer isnt it?
Avatar of jesusaflores
jesusaflores

If you need to show data for column 'sqlOut' in both tables, then you help with the UNION ALL statement, but if you want to search from one table to another you should use LEFT JOIN or RIGHT JOIN.