12-26-2007 3:11 AM
hi all, currently i need to do a select for etc,
field name (gender)
i need to retrieve the distinct values for gender which consist of female or male and do a count on it. Was figuring out how to do it. Thx~
12-26-2007 3:21 AM
12-26-2007 3:21 AM
12-26-2007 3:23 AM
data : IT_TAB1 type table of ZTAB.
data : IT_TAB2 type table of ZTAB.
data : N_M type I.
data : N_F type I.
select * from <ZTAB> into table IT_TAB1 where gender = 'MALE'.
describe table IT_TAB1 lines N_M. "N_M gives the no of males
select * from <ZTAB> into table IT_TAB2 where gender = 'FEMALE'.
describe table IT_TAB2 lines N_F. "N_F gives the no of females
Regards
Gopi
12-26-2007 3:24 AM
hi Prashant Patil ,
if let say my field for gender is a dynamic request whereby i allow user to select the fieldname first before coming to this screen. how should i do it? or anyone who knows? thx
12-26-2007 3:29 AM
Hi,
Try this code.
Select-options: <s_gender> for <datatype>.
Select count ( distinct (gender) ) from <dbtab> where gender in s_gender.
12-26-2007 3:34 AM
hi Gopi Narendra,
the code u gave me can it read dynamically from user input?
12-26-2007 3:38 AM
Instead of hardcoding, use the input parameter.
data : IT_TAB type table of ZTAB.
data : N type I.
parameters : p_gender type ZTAB-GENDER.
select * from <ZTAB> into table IT_TAB where gender = p_gender.
describe table IT_TAB lines N. "N gives the no of males or females according to the input p_gender
Regards
Gopi
ZTAB is the table which contains the data of the field GENDER
Edited by: Gopi Narendra on Dec 26, 2007 11:43 AM
12-26-2007 3:42 AM
12-26-2007 4:26 AM
u try this one....
SELECT COUNT(DISTINCT(GENDER)) FROM table where <condition>.
12-26-2007 4:29 AM
if u want hte count only..then use the functional module
CATT_GET_TABLE_ENTRIES
pass the table name to param2
then the where caluse to the rest.
12-26-2007 7:01 AM
hi all, let me go further into my exact scenario. for etc, my gender value which consist of female and male is inside a value table. so how should my select statement go about?