I have two tables containing different fields bar one. I want to merge the two subject to comparing one field using sql - is it possible?

Table1 has fields:
conkey reg when where
1 ABCDE 251011 EGLL
2 BCDEF 261011 EGLL
3 DEFGH 271110 EGKK

Table2 has fields:
conkey type connum
1 PA31 1234
2 PA34 2345
3 C421 456

I want Table3 to be:
conkey reg when where type connum
1 ABCDE 251011 EGLL PA31 1234
2 BCDEF 261011 EGLL PA34 2345
3 DEFGH 271110 EGKK C421 456

thanks

Recommended Answers

All 2 Replies

select table1.conkey, reg, when, [where], [type], connum from table1, table2 where table1.conkey = table2.conkey

it is not good to use keywords as field names, like where and type, consider renaming your fields. it will be worth it in the long run.

Many thanks for the reply and the code, very useful

rgds

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.