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

DBID - SQL question...

Status
Not open for further replies.

eyetry

Programmer
Oct 2, 2002
560
US
Built a Oracle SQL query that is joining columns from various tables, while using the 'distinct', 'union', and 'order by'.

Works well when I execute with Toad and Golden32 so I copied to DBID and built the tree etc.... Then wrote a map that executes the query. I'm now getting dup rows. Query looks something like...

select distinct(a.set_id),
'X' record_type,
b.user_id,
b.user_id_alt,
b.last_name,
b.first_name,
c.config_col1,
.
.
.
from table1 a, table2 b, table3 c,...
where a.value_1 = 'x'
and....
and....
and....
union
select distinct(a.set_id),
'Y' record_type,
b.user_id,
b.user_id_alt,
b.last_name,
b.first_name,
c.config_col1,
.
.
.
from table1 a, table2 b, table3 c,...
where a.value_1 = 'y'
and....
and....
and....
order by ......

Why would I need get duplicate x and y rows via DBID but not with one of the tools I used nor when using sqlplus?

 
Try the query again using Toad. Maybe the data has changed. Do a count(*) of the tables to see if the data has changed in the tables.
 
Shouldn't have taken Monday off. This was me being dumb again..... Set things up on Friday just got back to this yesterday.

I forgot I added columns to the query after I copied it to the DBID. The new columns were causing the issue. Grabbed the new column data from dif table and problem went away.

Works fine now.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top