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

Selecting on fields in an outer join

Status
Not open for further replies.

mdtimo

Programmer
Oct 18, 2001
38
US
I am dealing with three tables with the fields listed below

Time
-index
-tworkdt
-tudef
Cost
-index(links to costudf.index)
-cdisbdt
Costudf (there will be no record fo Costudf for Costs with no udf)
-index
-cudef

I want a querry that will list all the distinct values for both tudef and cudef. I am writing this for an Informix database

I have tried the following

select distinct(tudef) from time
UNION
select distinct(cudef) from cost,outer(costudf)
where cost.cindex=costudf.cindex

My results will display all the values but will display the null value twice. And I can't see how to avoid this.



 

It's strange what you say. The syntax looks ok and i don't know why this does not work.
Do you really need those nulls? If not, it's simple: try to filtrate in where with cudefis not null . senior rdbms specialist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top