>Dear all,
>
>I would like to ask how to
>1. To select from a table, namely StockPurchase, like so "SELECT DISTINCT sCode, sDetail, sID FROM stockPurchase WHERE sID= ?lsID AND oMID = ?loMID"
>2. Then, add other associate field from the same table eg. pCost,pDiscount,oMID
>
>The one I think of as follows:
>
>
>SELECT sCode, sDetail,pCost,pDiscount,sID,oMID FROM stockpurchase where exists;
>(SELECT DISTINCT sCode, sDetail, sID FROM stockPurchase WHERE sID= ?lsID AND oMID = ?loMID) ORDER BY sCODE
>
>
>However, duplicate records show up?! Where is the problem?
>
>Thanks in advance
There's nothing in your query that would cause duplicates, so the duplicates you're seeing must be in the data. There's nothing in your query that would eliminate duplicates if you have multiple records for the same sID and oMID. How are you defining "duplicate"? Is the pCost and pDiscount duplicated?