I use mysql sever and Use phpMyadmin that can write sql command
Main Topics
Browse All TopicsI have a field01 and feild02 how can i write my sql comman to get data like C and D below
table a table b
field01 field 02
0001 0001
0003 0002
0005 0003
0006 0004
field c field d
0005 0002
0006 0004
The out put of feilc is the member of table a ,field01 that not be long to table 02 ,feild 02
The out put of feild is the member of table b ,field02 that not be long to table 01 ,feild01
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: LowfatspreadPosted on 2004-03-17 at 01:29:08ID: 10613675
you basically can't
explain the business reason behind this...
which database system are you using?
in sql server you could do something like...
select field1,identity(int,1,1) as rowno into #temp1
from table1
where not exists (select field2 from table2
where field1 = field2)
select field2,identity(int,1,1) as rowno into #temp2
from table2
where not exists (select field1 from table1
where field1 = field2)
select field1 as fieldc,field2 as fieldd
from #temp1 inner join #temp2
on #temp1.rowno=#temp2.rowno