I'm joining two tables and selecting the key LPH.LPH_LAMPIRAN_NO as distinct. However it returns me with multiple values of the same LPH.LPH_LAMPIRAN_NO. Why is it so? Here is my statement
Select distinct(LPH.LPH_LAMPIRAN_NO), POD.POD_REF_NO, LPH.LPH_UPLOAD_DATE, LPD.LPD_ITEM_CODE, LPH.LPH_EPO_NO, EPH.EPH_CATEGORY from T_PO_DTL POD, T_LAMPIRAN_HDR LPH, T_EPO_HDR EPH, T_LAMPIRAN_DTL LPD WHERE POD.POD_REF_NO=LPH.LPH_LAMPIRAN_NO and EPH.EPH_EPO_NO=LPH.LPH_EPO_NO and POD.POD_PO_NO = 'alpo9283 ' and LPD.LPD_LAMPIRAN_NO = POD.POD_REF_NO
You are only selecting
distinct(LPH.LPH_LAMPIRAN_NO) as distinct value.
Select distinct LPH.LPH_LAMPIRAN_NO, POD.POD_REF_NO, LPH.LPH_UPLOAD_DATE, LPD.LPD_ITEM_CODE, LPH.LPH_EPO_NO, EPH.EPH_CATEGORY from ...
Ben de Boer
Yeah that's what I want. Only the LPH.LPH_LAMPIRAN_NO is distinct but it returns me with LPH.LPH_LAMPIRAN_NO that is not distinct.
About what kind of result u was thinking?
Try to undestend this situation:
what rows has to show oracle if u try to get
table has fields(a,b,c)
1 2 3
2 2 4
2 3 5
3 1 2
... espessialy for value a=2 ???:
select distinct(a), b, c from
This is logical nonsence.
distinct(a), b, c
1 2 3
2 ? ?
3 1 2
Last edited by Shestakov; 11-19-2002 at 12:24 PM.
Ok I get what you mean.
What I really want is I have two tables table1 and table2.
I want to select field1 from table1 where it is not equal to field2 of table2. In other selecting records where fields field1 != fields field2
from table1 t1, table2 t2
where t1.field1 <> t2.field2
Click Here to Expand Forum to Full Width