‎2008 Mar 04 7:04 AM
Dear All,
I have a small query on the Select Statement. If there are 2 identical rows and if i am retrieving them using the Select Statement, then will the select statement retrieves both the rows which are identical or only the first possible occurence? Pls help me out in this.
Thanks,
Sirisha.
‎2008 Mar 04 7:16 AM
Hi,
That depends on the statement u use. If u use, 'SELECT' statment, u can retrieve all the records which are identical with one or few fields. For that, u need to put the output INTO A TABLE.
Ex. 1
data : int_ekko type table of ekko with header line,
fs_ekko type ekko.
select * from ekko into table int_ekko where ebeln = '6361003191'.
Here, int_ekko is an internal table contains all records whose EBELN = 63610003191.
2) If u use 'SELECT SINGLE', then it will retrieve only the first record out of all the records who satisfy the condition EBELN = 6361003191.
Ex 2:
select single * from ekko into fs where ebeln = '63610003191'.
'fs' is not a table, just of type structure. so contains only one record.
Hope it help u..
Kindly reward points if hepful
Regards,
Shanthi.
Edited by: Shanthi on Mar 4, 2008 8:17 AM
‎2008 Mar 04 7:09 AM
Dear Sirisha,
that depends on ur select query. If u put SELECT SINGLE it retrieves first one only. IF u put SELECT * it retrieves all the data.
Regards,
Ajay
‎2008 Mar 04 7:10 AM
hi,
when u rare using select single it is going to select single records
if with normal select then all the records will be selected
‎2008 Mar 04 7:11 AM
It depends on the where condition u mention.
If you want to retirve MATNR 10002 from MARA.
If you write
SELECT * FROM MARA
INTO TABLE itab
WHERE matnr = '0000010002'.This will retrieve suppose if MATNR has two rows also. As it is a key firkld it wont have two rows.
Specify the table structure explain with a sample so that I can help you out.
‎2008 Mar 04 7:13 AM
‎2008 Mar 04 7:16 AM
Hi,
That depends on the statement u use. If u use, 'SELECT' statment, u can retrieve all the records which are identical with one or few fields. For that, u need to put the output INTO A TABLE.
Ex. 1
data : int_ekko type table of ekko with header line,
fs_ekko type ekko.
select * from ekko into table int_ekko where ebeln = '6361003191'.
Here, int_ekko is an internal table contains all records whose EBELN = 63610003191.
2) If u use 'SELECT SINGLE', then it will retrieve only the first record out of all the records who satisfy the condition EBELN = 6361003191.
Ex 2:
select single * from ekko into fs where ebeln = '63610003191'.
'fs' is not a table, just of type structure. so contains only one record.
Hope it help u..
Kindly reward points if hepful
Regards,
Shanthi.
Edited by: Shanthi on Mar 4, 2008 8:17 AM
‎2008 Mar 04 7:17 AM
Hi,
If you use SELECT SINGLE it will select only one row and that too the first row,pertaining to the condition given in WHERE clause.
Otherwise it will fetch all the duplicate row entries as well.
So what you can do is, use
DELETE ADJACENT DUPLICATES FROM itab.
where itab is the internal table into which the data is fetched thru the SELECT statement.
Reward if helpful.
Regards.