Union Querry

S

SHETTY

Dear Friends

Is it necessory that both the tables in to be joined must have equal no of
feilds while creating unio querries ?.

corresponding data field is not there in other table for a perticular field
in the first table, I want show that field details also

How to create union querry in such case

please advise

ramesh shetty
 
B

Bob Barrows [MVP]

SHETTY said:
Dear Friends

Is it necessory that both the tables in to be joined must have equal
no of feilds while creating unio querries ?.

No, it is only necessary that both select clauses contain the same number of
fields. The actual number of fields in the tables does not matter.

It is not even necessary that the names of the fields in each select
statement match. The names of the columns in the resultset come from the
first select statement in the union. As long as there is data of the same
datatype in each column in the subsequent select statements, the query will
work
corresponding data field is not there in other table for a perticular
field in the first table, I want show that field details also

How to create union querry in such case
If I am correctly interpreting this, then it is simply a matter of:

select tableAfield1, tableAtextfield2 from tableA
union All
select tableBfield1, "" As missingField from tableB

If this does not answer your question, then please show us a few rows of
sample data from each table and then show us the result you wish to obtain.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top