We help IT Professionals succeed at work.

Join table

Medium Priority
367 Views
Last Modified: 2012-05-11
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
Comment
Watch Question

Commented:
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

Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
malikirfan28:

Its a pain when you post the same answer isnt it?
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.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.