06-08-2009 5:42 AM
Hi All,
in table(ZBOX) records are like this
field1 field2 field3 field4
523012 FGD100 FGD500 BOTTLE
523012 FGD501 FGD800 BOX
Now in selection parameters i am giving FGD200, Based on this value how to get the record(1st record) from Ztable(ZBOX).
please tell me how to write the select query regarding this.
Thanks in advance.
06-08-2009 5:52 AM
Hi,
Either you can use select single or select UPTO 1 rows statement to fetch the first record based on ur selection.
Select single field1 field2 field3 field4 from ZBOX
where field1 = selection parameter.
06-08-2009 5:53 AM
HI.
do u want to select the first record from the ztable ( zbox ).
Is that the condition.
06-08-2009 6:00 AM
Hi,
I don't want only first record, i have given one example.
523012 FGD100 FGD500 BOTTLE
523013 FGD501 FGD800 BOX
523014 FGD801 FGD900 BOX
suppsoe if iam giving FGD520 System has to fetch 2nd record , like the same way if i am giving FGD822 System has to fetch 3rd record ...
Edited by: satya palli on Jun 8, 2009 7:01 AM
06-08-2009 6:13 AM
Hello
select single * from ZBOX where field2 <= p_parameter and field3 > p_parameter.
06-08-2009 5:58 AM
Hai,
Write the SELECT Query as follows:
SELECT * FROM ZBOX WHERE fieldname = FGD200.
06-08-2009 6:15 AM
Hi,
DATA V_VALUE(4) , NEW_VAL(5).
Move the value of the first 4 characters of the parameter FIELD3 to V_VALUE.
eg. if FGD520 we will move FGD5 to V_VALUE.
then concatenate V_VALUE '%' into NEW_VAL.
SELECT single * FROM <table name> into <work area> where FIELD3 LIKE NEW_VAL.
Hope this will help you.
Regards,
Smart Varghese
06-08-2009 6:23 AM
Hi
If field2 is a char field, then obviously FGD100 is < FGD200.
So your slecet query must be
Select *
from ZBOX
where field2 < 'FGD200'.
06-08-2009 7:07 AM
Hi Satya,
Select query should be like below
SELECT SINGLE *
FROM zbox
WHERE field2 <= 'FGD200'
AND field3 > 'FGD200'.
Thanks
Venkat
10-04-2009 12:42 PM