Link to home
Start Free TrialLog in
Avatar of anumoses
anumosesFlag for United States of America

asked on

duplicates in data - oracle forms built with where clause

Block name - CALLER_SCHEDULES Built with where clause

query data source name- caller_schedules cs, system_users@pdon_new su

where clause - cs.user_id = su.user_id
and cs.schedule_date =:sched_date.in_date

order by - order by su.user_last_name
----------------
When I run this query get duplicates. This is an old form developed by old employee not working here anymore.

select cs.user_id, su.user_last_name,cs.schedule_date,
          cs.hours_worked, cs.goal, cs.team_id
from caller_schedules cs, system_users@pdon_new su
where cs.user_id = su.user_id
and cs.schedule_date ='07-aug-2012'
order by su.user_last_name

If I use distinct will get no duplicates. Any help appreciated

There is a decode also

and cs.team_id = decode(:sched_date.team_id ,'ALL', cs.team_id ,:sched_date.team_id)
screen.JPG
SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of anumoses

ASKER

yes joins are correct. Verified both the tables. I want to use distinct, but where can I use in the form? That's my problem
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Please comment on the sensitive data and company information in the image...

I'm not a Forms person but you posted a select statement.  If the form is created from that select, can you not modify the select?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>Its database issue.

What was the issue?
There was no primary key. So I had to create constraints. and change the form to be based on only one table that gets updated and the rest post query. Enforcing primary key at the form level also.
So it was duplicate data?
yes.
re: http:#a38311528 "Then check you don't have duplicate data in one or more of the tables that is causing the data to be duplicated."
then http:#a38311665 "maybe someone duplicated records in system_users@pdon_new"
thanks