Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting data from 2 non-related tables in a query 2

Status
Not open for further replies.

paramit81

Technical User
Dec 3, 2004
11
US
Hi All,
I am trying to build a query, which needs me to get data from 2 which dont have any relationship, based on some criteria. Here is an explanation of my problem:
I have 2 tables Table1 and Table2. Both of them have a field called 'Name'. I want some other fields to be shown in the query result if and only if the 'Name' in 'Table2' matches 'Name' in 'Table1'.
I dont know How to do this with query wizard or any other option. So if any of u can help me out, I would really appreciate that.
 
A starting point:
SELECT Table1.*, Table2.*
FROM Table1 INNER JOIN Table2 ON Table1.Name=Table2.Name

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
something like this:

Code:
SELECT T1.F1, T1.F2, T2.F1
FROM T1, T2
WHERE T1.NAME IN (SELECT NAME FROM T2)

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top