‎2007 Oct 26 1:26 PM
Below statement how many records will fetch from bsad table?is it total records of Bseg table & single record of Bseg table.
SELECT SINGLE * FROM BSAD WHERE AUGBL = I_BSEG-AUGBL
AND BELNR NE I_BSEG-BELNR
AND BELNR NE I_BSEG-AUGBL.
‎2007 Oct 26 1:30 PM
SELECT SINGLE * will select only single record from that table,
Why did u get that doubt??
SELECT SINGLE will always select only 1 record,
SELECT SINGLE * will also select only one record but all the fields will be selected
‎2007 Oct 26 1:47 PM
Hi Vishnu,
Select SINGLE always gets only 1 record .
Reward If Useful,
Regards,
Chitra
‎2007 Oct 26 5:23 PM
Hi Vishnu,
Your select statement will extract only ONE record from BSAD table, based on the where condition of BSEG values.
Which means Select Single * will get only one record at a time. Here 'Single' denotes one record and '*' denotes all the fields of the table BSAD.
Hope this helps.
Thanks,
Srinivasa
‎2007 Oct 26 5:28 PM
It will get either 0 or 1 record depending on whether or not the condition in the WHERE is met. (But performance will be an issue. There is probably a simpler way to do this. What do you need to do?)
Rob
‎2007 Oct 27 5:31 AM
hi,
you will get only one row of all the colums for the given condition.
SELECT SINGLE * always fetch only one row whereas SELECT SINGLE <field>
fetch only one value for that particular field.
Thanks,
Senthil kumar
‎2007 Oct 27 11:24 PM
As Rob says, no records from BSEG (there's no select from BSEG) and either 1 or 0 from BSAD... I'd guess 1 because the 2 "NE" should be satisified by zillions of entries. My concern mirror Rob's comments - a select statement like
SELECT SINGLE * FROM BSAD WHERE AUGBL = I_BSEG-AUGBL
AND BELNR NE I_BSEG-BELNR
AND BELNR NE I_BSEG-AUGBL.
has the ability to bring your database to its knees - unless you have added some local indexes it will do a slow table scan. When accessing BSAD, always try to specify as many elements of the key as possible... if you have just retrieve a BSEG record (as indicated from the "I_BSEG" code) then use the KUNNR from that row to start with, and then the other BSAD fields. At least then your database may only have a few hundred / thousand rows to process.
Jonathan