remove duplicates from a query containing more than 1 table [message #218271] |
Wed, 07 February 2007 10:12 |
deahayes3
Messages: 203 Registered: May 2006
|
Senior Member |
|
|
I have a query I have created, how ever is has too many duplicates, like 50k, I added a DISTINCT to one of the variables and now its like 25k, what else can I use to remove all these duplicates it should have less than 1000 records. Heres my code. Thanks for any help.
select distinct(p.project_id), p.segment1, p.name, I.INVENTORY_ITEM_ID, I.SEGMENT1, M.PROJECT_ID, M.INVENTORY_ITEM_ID, M.PROJECT_NUMBER ,
a.task_id, a.project_id, A.TASK_NAME, A.TASK_NUMBER, D.PROJECT_ID, D.PROJECT_NUMBER, D.PROJECT_NAME
from SYSTEM_ITEMS I, SCHEDULE_ITEM_DATES_V M, pa.pa_projects_all p, pa.pa_tasks a , DISCRETE_JOBS_V D
where p.project_id = a.project_id and P.PROJECT_ID = D.PROJECT_ID
AND m.project_id = p.project_id and I.INVENTORY_ITEM_ID = M.INVENTORY_ITEM_ID and
p.project_id = '165003' AND P.SEGMENT1 = '1018101'
|
|
|
|
|