How can i prevent duplicate rows being selected in a select query? How can i prevent duplicate rows being selected in a select query? oracle oracle

How can i prevent duplicate rows being selected in a select query?


If your SELECT statement has a DISTINCT in it, then all of the returned records have a unique combination of values across the columns you are selecting. You need to identify which columns return different values across the records you deem to be duplicated.


If you look at the query translated to SQL Server type SQL you will see that there is no relation between your bofcs table and the rest of your data. Basically it is returning every record in the bofcs' temperature field, and that may be producing duplicate results?.

SELECT     bbp.SUBCAR "Treadwell",      bbp.BATCH_ID "Batch ID",      bcs.SILICON "Si",      bcs.SULPHUR "S",     bcs.MANGANESE "Mn",      bcs.PHOSPHORUS "P",      to_char(bcs.SAMPLE_TIME,'dd-MON-yy hh24:MI') "Sample Time",      to_char(bbp.START_POUR, 'dd-MON-yy hh24:MI') "Start Pour Time",     to_char(bbp.END_POUR, 'dd-MON-yy hh24:MI') "End pour Time",      bofcs.temperature "Temperature"FROM      bof_chem_sample bcs, INNER JOIN      bof_batch_pour bbp,ON     bbp.BATCH_ID=bcs.BATCH_IDINNER JOIN     bof_celox_sample bofcsON     **-- NO RELATION B/N BOFCS and the other tables????**WHERE      bcs.SAMPLE_CODE= to_char('D1') AND      bcs.SAMPLE_TIME>=to_date('01-jan-10')