‎2006 Nov 13 1:15 PM
I was doing a select in a program and I was selecting specific fields. I noticed that if there was more that one record with the same values in the fields that I was selecting, it would only retreive one record. I had to put a field in the select that was unique so that I could extract all of the records. Is there something that I have to code in the select statement to be able to retreive all of the records that have the same values or is it that I have to include a unique identifier in the select.
thanks in avdance.
‎2006 Nov 13 2:32 PM
This is an issue whe you SELECT using FOR ALL ENTRIES. If you check the documentation, you'll see that duplicate entries are discarded, so if you want all records, you have to make the selection unique.
Rob
‎2006 Nov 13 1:17 PM
Not sure if I understand the questoin completely.
1. If you want distinct rows only
SELECT DISTINCT FIELD1 FIELD2 .... INTO TABLE .......
2. If you want to select all the rows
SELECT FIELD1 FIELD2 .... INTO TABLE .......
Regards,
Ravi
Note : Please mark all the helpful answers
‎2006 Nov 13 1:20 PM
Hi Timothy,
If it is that way, you can select * (Instead of specific fields) .
If you get only specific fields, whats is the point in getting duplicate records?
Regards,
Ravi
‎2006 Nov 13 1:35 PM
Hi Tim,
By default SELECT will fetch all the records when there are more than one record. You can avoid it by using DISTICT addition.
But by your question I understand you want duplicate records too. You no need to write any addition for your SELECT as it fetches all the records.
If you can write the query we could help you better.
Regards
Surya.
‎2006 Nov 13 1:35 PM
Hi Timothy,
There must be distinct value for atleast one field to retrieve the records having same values for differnet fileds. or else it would not b epossible in the way u want.
regards,
keerthi.
‎2006 Nov 13 1:45 PM
Timothy.
Select fields into table itab from ztab.
The above should fetch all the records irrespective of duplicates...Now, as you said that it is not fetching duplicates records it can be due to defn of you internal table is it a standard table or other ? If not please check there might be a code which would deleting the adjacent duplicates and hence a single record ?
Regards
Anurag
‎2006 Nov 13 2:32 PM
This is an issue whe you SELECT using FOR ALL ENTRIES. If you check the documentation, you'll see that duplicate entries are discarded, so if you want all records, you have to make the selection unique.
Rob