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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adoquery sql string

Status
Not open for further replies.

kyriakos70

Programmer
Jul 24, 2008
87
GR
Hello
I want to create a query with ADOQUERY where I want to search in two detail tables a field which is the same and has unique value for both tables, eg table individuals the detail table car_file has a field id and table companies the detail table car_file has the same field id which is global and unique (you don't find the same number either in each table nor between them), how can I syntax the sql to search in both detail tables the field id and display the results?

Thank you
Kyriakos
 
Look up UNION. It will let you combine the results of multiple SQL statements into one result set.

SELECT AField
FROM ATable
WHERE ASomeCondition
UNION ALL
SELECT BField
FROM BTable
WHERE BSomeCondition

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top