Join two tables [message #291132] |
Thu, 03 January 2008 02:04  |
sssnbj
Messages: 3 Registered: January 2008
|
Junior Member |
|
|
hi,
this might sound very basic, but am sure there must be an easy way to do it!
am trying to join two tables A,B on a key K , the problem is that there are value of K in A that are not in B
and accordingly the join will return the smaller set common in borth tables, while what I really want is to have the common set in addition to the other records with some default values in case of mismach.
what I did was a lengthy SQL which works fine:
I join A,B normally to get the commen records from A,B and then I UNION the result with a A MINUS B (adding default values in the select clause for columns supposingly comming from B) this is an SQL statement with 3 sub queries (too much for a simple job, isnt it)
Please let me know of any better way to do this job,
thanks
[Updated on: Thu, 03 January 2008 02:06] Report message to a moderator
|
|
|
|
|
|