07-19-2007 6:55 AM
CAN I USE 2 FOR ALL ENTRIES IN A SINGLE SELECT STATMENT
FOR JOINING 3 DATABASE TABLE
07-19-2007 7:00 AM
Hi Ashok,
No. You can use for all entries only one time in select.
If you want to join 3 tables.logic should be.
1. select data into first table
2. select data into second table for all entries in first table
3. select data into third table for all entries in first or second table.
Reward points if useful,
Aleem.
07-19-2007 6:57 AM
For all entries can be used only once in a select statement. For joining 3 tables, you can use the join addition with the select statement provided the joined tables have at least one common field.
07-19-2007 6:58 AM
Hi
- For example:
SELECT-OPTIONS: SO_VBELN FOR VBAK-VBELN.
U can write:
SELECT ............... FROM VBAK INNER JOIN VBAP ON VBAK-VBELN = VBAP-VBELN
or
SELECT * FROM VBAK INTO TABLE T_VBAK WHERE VBELN IN SO_VBELN
SELECT * FROM VBAP
FOR ALL ENTRIES IN T_VBAK WHERE VBELN = T_VBAK-VBELN.
- When u use SELECT SINGLE statament the system'll try to active certain strategies to improve the reading performance, i.e. it'll try to use the primary index, but it can use only if you use all key fields in WHERE condition.
So if you need to get the first record and you can't use all keys in WHERE condition it would be better use SELECT UPTO ONE ROW than SELECT SINGLE
Regards
07-19-2007 6:58 AM
No matter how many database tables you join, you can't use 2 FOR ALL ENTRIES in your SELECT query.
Regards,
Pavan
07-19-2007 6:58 AM
Hi,
You cannot use 2 for all entries. You will have to use Joins.
Regards,
Shruthi R
07-19-2007 7:00 AM
Hi Ashok,
No. You can use for all entries only one time in select.
If you want to join 3 tables.logic should be.
1. select data into first table
2. select data into second table for all entries in first table
3. select data into third table for all entries in first or second table.
Reward points if useful,
Aleem.