Difference in count(*) query and select * query results

i am using Oracle9i Enterprise Edition Release 9.2.0.8.0.
in a table select count(*) returns 34, but when i run select * statement it returns only 6 rows. Results are pasted below. Can any one knows the reason of this mismatch
SQL> select * from pay_at;
EMP_CODE STA IN_OUT_DA TIME
100341 IN 07-MAR-04 09:32
100341 OUT 07-MAR-04 10:24
103165 IN 31-MAR-03 14:41
103165 OUT 31-MAR-03 20:00
101204 IN 19-APR-04 13:00
101204 OUT 19-APR-04 23:59
6 rows selected.
SQL> select count(*) from pay_at;
COUNT(*)
34
------------------------------------------------------

Maybe you pressed CTRL-c during the fetch phase of "select * from" ?
If this is not the case, try to build a very small test case we can run that shows this behaviour and post it here.
Regards,
Rob.

Similar Messages

  • Difference between Report painter and abap query .

    can anyone please tell me the difference between the report painter and the ordinary alv,clasical reporting and also the difference between Report painter and abap query. How the output format will be in Report painter. If anyone has any documents please send it to
    [email protected]
    Thanks,
    Joseph.

    hi,
    ABAP Query is an ABAP Workbench tool that enables users without knowledge of the ABAP programming language to define and execute their own reports.
    In ABAP Query, you enter texts and select fields and options to determine the structure of the reports. Fields are selected from functional areas and can be assigned a sequence by numbering.
    link for abap query --
    https://forums.sdn.sap.com/click.jspa?searchID=221911&messageID=2790992
    whereas the Report Painter enables you to report on data from various applications. It uses a graphical report structure that forms the basis for the report definition. When defining the report, you work with a structure that corresponds to the final structure of the report when the report data is output.
    link for report painter --
    https://forums.sdn.sap.com/click.jspa?searchID=221874&messageID=1818114
    Regards,
    pankaj singh
    Message was edited by:
            Pankaj Singh
    Message was edited by:
            Pankaj Singh

  • In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    The query is re-issued as a flashback query and the client process can continue to fetch from the cursor. This is described in the Net Services Administrators Guide, the section on Transparent Application Failover.

  • Difference between "print" statements and "select" statements , TSQL

     What is the difference between "print" statements and "select" statements when it omces to debugging and watching varibles in the stored procs .....

    SELECT statement is part of the ANSI SQL language.
    PRINT command is not part of the SQL language, it is used for debugging in T-SQL.
    BOL:" Returns a user-defined message to the client.
    A message string can be up to 8,000 characters long if it is a non-Unicode string, and 4,000 characters long if it is a Unicode string. Longer strings are truncated. The
    varchar(max) and nvarchar(max) data types are truncated to data types that are no larger than
    varchar(8000) and nvarchar(4000).
    RAISERROR can also be used to return messages. RAISERROR has these advantages over PRINT:
    RAISERROR supports substituting arguments into an error message string using a mechanism modeled on the printf function of the C language standard library.
    RAISERROR can specify a unique error number, a severity, and a state code in addition to the text message.
    RAISERROR can be used to return user-defined messages created using the sp_addmessage system stored procedure."
    LINK: http://technet.microsoft.com/en-us/library/ms176047.aspx
    The SSMS (client software) returns SELECT output to Results and PRINT output to Messages.
    The SQLCMD -o (output file) option captures all outputs into one file mixed.
    Kalman Toth Database & OLAP Architect
    T-SQL Scripts at sqlusa.com
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to call both xacute query and xml query inside a single applet

    Hi,
    I am very new to XMII. Trying with a simple exercises now.
    1.  I have a Business Logic Transaction which will call external application using web services then it will get an output as xml and storing it in C:\.
    2. Then I created one xacute query which will call the transaction
    3. Then I created a xml query that will read the xml in c:\ and I too created a visual display template(ichart)  for it
    4. Created a html file -- created a applet , called all the 3 inside it. NOt getting any graph in IE
    5. But if I call only xml query and display query its working
    <b>following are my HTML file:</b>
    <html>
    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Order Percent Complete</title>
    </head>
    <body>
    <p>
    <APPLET NAME="MyApplet" WIDTH="640" HEIGHT="400" CODE="iChart" CODEBASE="/Illuminator/Classes" ARCHIVE="illum8.zip" MAYSCRIPT>
    <PARAM NAME="QueryTemplate" VALUE="UserTemplates/POTxnTemplate">
    <PARAM NAME="QueryTemplate" VALUE="UserTemplates/POTemplate">
    <PARAM NAME="DisplayTemplate" VALUE="UserTemplates/POVisual">
    </APPLET>
    </p>
    </body>
    </html>
    6. In POTxnTemplate -- calling Transaction BL
        In POTemplate -- fetching xml from c:\
        In POVisual -- displaying the ichart (using POTemplate)
    Can any one help me with this?
    I am doing in the right path?
    Thanks in Advance,
    Murugappan.

    Hello,
    You can only enter one query template into an applet.  Use the xacute query template.  In the transaction assign the output of the web services results to a transaction property of type xml making sure you select the "Output Parameter?" option.  These results will need to be in xMII format.  Then open the xacute query template and verify that the output parameter you created is selected as an Output on the transaction tab.

  • Sapquery , adhoc query and Infoset query

    any body having any material for ADHOC QUERY , SAP QUERY and Infoset query with detail explanation and steps for creation.
    plz forward it to me??????????

    hi,
       sap query r used to design reports to see the data according to our selections in this daa is fetched from diff tables its  much easier to desing reports using this
                 infoset query is somthign used with BI ints used to read data form PSA some temp storage loc
               if i am wrong someone correct me
    reward if useful
    ravi

  • Regarding Sender query and receiver query

    Hi Masters
          I have one sender query and receiver query. Both queries contain G/L account.
    First I got sender query report, in this report I drill down one free charactteristics field to get correponding field sales document in receiver report.
    Is it mandatory which field i drill down in sender report should be in receiver report?
    Could you please help ?
    Thanks in Advance
    Raja.S

    I would rewrite the first one to:
    Select t.id_entity,t.id_trade_ref,p.am_stock
    from trade t,posting p
    where t.id_trade_ref = '5V973781B'
    and p.id_trade_ref = t.id_trade_ref
    This way, you really make the join between the table.
    I think the join is better because it uses less code. I do not think you will notice much performance win between one or the other, especially because it concerns only a few rows.

  • Modes and Methods in Tag Query and SQL Query

    Hi,
    Can someone explain me about the modes available in <b>TAG Query and SQL Query.</b>
    TAG Query has modes such as <b>Current, CurrentWrite, GroupList, History, HistoryEvent, ModeList, Statistics and TagList</b>
    SQL Query i still have doubt on <b>FixedQuery with output , Modelist and TableList</b>
    I also need to know why methods are used?
    Thanks in advance
    Regards
    Muzammil

    I'll try to  explain to the best of my knowledge :
    <u><b>TagQuery</b></u>
    <b>Current</b> : Gives you the current value of the Tag you are reading.
    <b>CurrentWrite</b> : Let you write a Value as the Current Value of the Tag.
    <b>GroupList</b> : Generally Tags are grouped under different groups. Returns you the name of the Groups.
    <b>From the xMII Help Document :</b>
    <b>History</b> : History Mode returns interpolated data.  Interpolation can be accomplished by specifying either the # of rows desired or the retrieval resolution.  If the mode is "History" and a value is provided for the Resolution parameter (which is in seconds), the connector will retrieve evenly-spaced values starting at the beginning of the time interval, up to the maximum # of rows specified in the RowCount parameter.  If no value is provided for the Resolution parameter, the connector will return an evenly-spaced number of values based on the value of the RowCount parameter.
    For example, if the time interval is 1 hour, Resolution is 15, and RowCount is 240, the connector will return evenly spaced values each 15 seconds, up to 240 values (which would span the entire hour).
    If the time interval is 1 hour, Resolution is not provided or is set to zero, and RowCount is 120, the connector would return 120 evenly spaced values, at an effective interval of 30 seconds.
    <b>HistoryEvent Mode</b> : The connector can provide historical values "as they were stored" the database.  This mode provides no interpolation of values.
    <b>Statistics Mode</b> : When retrieving data for statistical calculations, the connector utilizes the same techniques as in the "HistoryEvent"  mode.  It is important to note that the first two returning columns in the HistoryEvent query must be the timestamp and the value, in that order.  The SAP xMII Statistical processor expects that order, or errors will occur.  This ensures precision of statistical measurements, particularly time-weighted average, by using the exact storage time and values from the historical database.  The SAP xMII system provides the statistical calculations.
    <b>Modelist</b> : Basically returns the modes of the Query Available. The Data returned is same as the data in the Modes list in the Quert Template Editor.
    <b>Taglist</b> : Returns all the Tags in the Datasource.
    <u><b>SQL Query</b></u>
    <b>Modelist</b> : Same as above.
    <b>TableList</b> : List of all the tables in the database to which the connector connects.
    Again from SAP xMII Help Documentation :
    <b>FixedQueryWithOutput</b> : This mode is used to execute an Oracle stored procedure or function that returns a REF CURSOR as output.  The position of the REF CURSOR is marked by a "?" in the query.  For example:
    <b>Create a table.</b>
    <i>create table usage (id int, name varchar(50));
    insert into usage (id, name) values (1, 'test1');
    insert into usage (id, name) values (2, 'test2');
    insert into usage (id, name) values (3, 'test3');
    insert into usage (id, name) values (4, 'test4');
    insert into usage (id, name) values (5, 'test5');
    insert into usage (id, name) values (6, 'test6');
    insert into usage (id, name) values (7, 'test7');
    insert into usage (id, name) values (8, 'test8');</i>
    <b>Define the stored procedure.</b>
    <i>DROP PACKAGE foopkg;
    CREATE PACKAGE foopkg IS
      TYPE cursortype is ref cursor;
      PROCEDURE test (mycursor in out cursortype);
    END foopkg;
    CREATE PACKAGE BODY foopkg IS
      PROCEDURE test (mycursor in out cursortype) AS
      BEGIN
         open mycursor for select * from usage;
      END;
    END foopkg;
    </i>
    Define a query template for calling the stored procedure.  Enter the following in the FixedQuery tab:
    <b>call foopkg.test(?)</b>
    This template returns all rows from the Usage table.

  • Ad hoc query and Sap query

    Hi all
    What are Ad hod query and sap query? Why we use these two?
    thanks and regards
    Seenu

    in order to get the reports as per the client requiremnt
    we use the queries
    and the the data from these queries will be taken form PNP logical data based tables
    EX: in the standrad report for Absences
    the client may ask for
    PERNR   NAME    position   Department  Absence type start date Endate
    in the standrad report u can get the PERNR and Absence type and start date and end date
    but u cannot get position and department
    so we use  Queries we select the feidls from various reports and get a farmot as per the client reqiremnt
    Check SQ01  02  03 tcoeds
    u can alsoc check SQVI

  • Detail differentiation between add query,combined query and sub query

    HI
    I would like to know the detail differentiation between add query,combined query and sub query with  universe
    correct me if I a wrong
    Add query : adding of different query from different universe and also with in same universe.
    Combined query : combining query using operators(Union,intersection,minus)with in same universe.
    Sub query :getting results from the sub query and the result serves as the data for main  query within same universe.

    Hi,
    I would advise you to check the product documentation under http://help.sap.com/
    regards
    Steph

  • Basic query regarding work-area and select query

    hi
    dear sdn members,
    thanks too all for solving all my query's up till now
    i am stuck in a problem need help
    1)  why basically work-area has been used ? the sole purpose
    2)  different types of select query ? only coding examples
    note: no links pls
    regards,
    virus

    hi,
    Work Area
    Description for a data object that is particularly useful when working with internal tables or database tables as a source for changing operations or a target for reading operations.
    WORKAREA is a structure that can hold only one record at a time. It is a collection of fields. We use workarea as we cannot directly read from a table. In order to interact with a table we need workarea. When a Select Statement is executed on a table then the first record is read and put into the header of the table and from there put into the header or the workarea(of the same structure as that of the table)of the internal table and then transferred top the body of the internal table or directly displayed from the workarea.
    Each row in a table is a record and each column is a field.
    While adding or retrieving records to / from internal table we have to keep the record temporarily.
    The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
    Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
    .g.
    data: begin of itab occurs 10,
    ab type c,
    cd type i,
    end of itab. " this table will have the header line.
    data: wa_itab like itab. " explicit work area for itab
    data: itab1 like itab occurs 10. " table is without header line.
    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.
    With header line
    SELECT.
    Put the curson on that word and press F1 . You can see the whole documentation for select statements.
    select statements :
    SELECT result
    FROM source
    INTO|APPENDING target
    [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
    Effect
    SELECT is an Open-SQL-statement for reading data from one or several database tables into data objects.
    The select statement reads a result set (whose structure is determined in result ) from the database tables specified in source, and assigns the data from the result set to the data objects specified in target. You can restrict the result set using the WHERE addition. The addition GROUP BY compresses several database rows into a single row of the result set. The addition HAVING restricts the compressed rows. The addition ORDER BY sorts the result set.
    The data objects specified in target must match the result set result. This means that the result set is either assigned to the data objects in one step, or by row, or by packets of rows. In the second and third case, the SELECT statement opens a loop, which which must be closed using ENDSELECT. For every loop pass, the SELECT-statement assigns a row or a packet of rows to the data objects specified in target. If the last row was assigned or if the result set is empty, then SELECT branches to ENDSELECT . A database cursor is opened implicitly to process a SELECT-loop, and is closed again when the loop is ended. You can end the loop using the statements from section leave loops.
    Up to the INTO resp. APPENDING addition, the entries in the SELECTstatement define which data should be read by the database in which form. This requirement is translated in the database interface for the database system´s programming interface and is then passed to the database system. The data are read in packets by the database and are transported to the application server by the database server. On the application server, the data are transferred to the ABAP program´s data objects in accordance with the data specified in the INTO and APPENDING additions.
    System Fields
    The SELECT statement sets the values of the system fields sy-subrc and sy-dbcnt.
    sy-subrc Relevance
    0 The SELECT statement sets sy-subrc to 0 for every pass by value to an ABAP data object. The ENDSELECT statement sets sy-subrc to 0 if at least one row was transferred in the SELECT loop.
    4 The SELECT statement sets sy-subrc to 4 if the result set is empty, that is, if no data was found in the database.
    8 The SELECT statement sets sy-subrc to 8 if the FOR UPDATE addition is used in result, without the primary key being specified fully after WHERE.
    After every value that is transferred to an ABAP data object, the SELECT statement sets sy-dbcnt to the number of rows that were transferred. If the result set is empty, sy-dbcnt is set to 0.
    Notes
    Outside classes, you do not need to specify the target area with INTO or APPENDING if a single database table or a single view is specified statically after FROM, and a table work area dbtab was declared with the TABLES statement for the corresponding database table or view. In this case, the system supplements the SELECT-statement implicitly with the addition INTO dbtab.
    Although the WHERE-condition is optional, you should always specify it for performance reasons, and the result set should not be restricted on the application server.
    SELECT-loops can be nested. For performance reasons, you should check whether a join or a sub-query would be more effective.
    Within a SELECT-loop you cannot execute any statements that lead to a database commit and consequently cause the corresponding database cursor to close.
    SELECT - result
    Syntax
    ... lines columns ... .
    Effect
    The data in result defines whether the resulting set consists of multiple rows (table-like structure) or a single row ( flat structure). It specifies the columns to be read and defines their names in the resulting set. Note that column names from the database table can be changed. For single columns, aggregate expressions can be used to specify aggregates. Identical rows in the resulting set can be excluded, and individual rows can be protected from parallel changes by another program.
    The data in result consists of data for the rows lines and for the columns columns.
    SELECT - lines
    Syntax
    ... { SINGLE }
    | { { } } ... .
    Alternatives:
    1. ... SINGLE
    2. ... { }
    Effect
    The data in lines specifies that the resulting set has either multiple lines or a single line.
    Alternative 1
    ... SINGLE
    Effect
    If SINGLE is specified, the resulting set has a single line. If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set. The data objects specified after INTO may not be internal tables, and the APPENDING addition may not be used.
    An exclusive lock can be set for this line using the FOR UPDATE addition when a single line is being read with SINGLE. The SELECT command is used in this case only if all primary key fields in logical expressions linked by AND are checked to make sure they are the same in the WHERE condition. Otherwise, the resulting set is empty and sy-subrc is set to 8. If the lock causes a deadlock, an exception occurs. If the FOR UPDATE addition is used, the SELECT command circumvents SAP buffering.
    Note
    When SINGLE is being specified, the lines to be read should be clearly specified in the WHERE condition, for the sake of efficiency. When the data is read from a database table, the system does this by specifying comparison values for the primary key.
    Alternative 2
    Effect
    If SINGLE is not specified and if columns does not contain only aggregate expressions, the resulting set has multiple lines. All database lines that are selected by the remaining additions of the SELECT command are included in the resulting list. If the ORDER BY addition is not used, the order of the lines in the resulting list is not defined and, if the same SELECT command is executed multiple times, the order may be different each time. A data object specified after INTO can be an internal table and the APPENDING addition can be used. If no internal table is specified after INTO or APPENDING, the SELECT command triggers a loop that has to be closed using ENDSELECT.
    If multiple lines are read without SINGLE, the DISTINCT addition can be used to exclude duplicate lines from the resulting list. If DISTINCT is used, the SELECT command circumvents SAP buffering. DISTINCT cannot be used in the following situations:
    If a column specified in columns has the type STRING, RAWSTRING, LCHAR or LRAW
    If the system tries to access pool or cluster tables and single columns are specified in columns.
    Note
    When specifying DISTINCT, note that you have to carry out sort operations in the database system for this.
    SELECT - columns
    Syntax
    | { {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ... }
    | (column_syntax) ... .
    Alternatives:
    1. ... *
    2. ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    3. ... (column_syntax)
    Effect
    The input in columns determines which columns are used to build the resulting set.
    Alternative 1
    Effect
    If * is specified, the resulting set is built based on all columns in the database tables or views specified after FROM, in the order given there. The columns in the resulting set take on the name and data type from the database tables or views. Only one data object can be specified after INTO.
    Note
    If multiple database tables are specified after FROM, you cannot prevent multiple columns from getting the same name when you specify *.
    Alternative 2
    ... {col1|aggregate( col1 )}
    {col2|aggregate( col2 )} ...
    Effect
    A list of column labels col1 col2 ... is specified in order to build the resulting list from individual columns. An individual column can be specified directly or as an argument of an aggregate function aggregate. The order in which the column labels are specified is up to you and defines the order of the columns in the resulting list. Only if a column of the type LCHAR or LRAW is listed does the corresponding length field also have to be specified directly before it. An individual column can be specified multiple times.
    The addition AS can be used to define an alternative column name a1 a2 ... with a maximum of fourteen digits in the resulting set for every column label col1 col2 .... The system uses the alternative column name in the additions INTO|APPENDING CORRESPONDING FIELDS and ORDER BY. .
    Column labels
    The following column labels are possible:
    If only a single database table or a single view is specified after FROM, the column labels in the database table - that is, the names of the components comp1 comp2... - can be specified directly for col1 col2 ... in the structure of the ABAP Dictionary.
    If the name of the component occurs in multiple database tables of the FROM addition, but the desired database table or the view dbtab is only specified once after FROM, the names dbtab~comp1 dbtab~comp2 ... have to be specified for col1 col2 .... comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    If the desired database table or view occurs multiple times after FROM, the names tabalias~comp1 tabalias~comp2 ... have to be specified for col1 col2 .... tabalias is the alternative table name of the database table or view defined after FROM, and comp1 comp2 ... are the names of the components in the structure of the ABAP Dictionary.
    The data type of a single column in the resulting list is the datatype of the corresponding component in the ABAP Dictionary. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note
    If multiple database tables are specified after FROM, you can use alternative names when specifying single columns to avoid having multiple columns with the same name.
    Example
    Read specific columns of a single row.
    DATA wa TYPE spfli.
    SELECT SINGLE carrid connid cityfrom cityto
    INTO CORRESPONDING FIELDS OF wa
    FROM spfli
    WHERE carrid EQ 'LH' AND connid EQ '0400'.
    IF sy-subrc EQ 0.
    WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
    ENDIF.
    Alternative 3
    ... (column_syntax)
    Effect
    Instead of static data, a data object column_syntax in brackets can be specified, which, when the command is executed, either contains the syntax shown with the static data, or is initial. The data object column_syntax can be a character-type data object or an internal table with a character-type data type. The syntax in column_syntax, like in the ABAP editor, is not case-sensitive. When specifying an internal table, you can distribute the syntax over multiple rows.
    If column_syntax is initial when the command is executed, columns is implicitly set to * and all columns are read.
    If columns are specificied dynamically without the SINGLE addition, the resulting set is always regarded as having multiple rows.
    Notes
    Before Release 6.10, you could only specify an internal table with a flat character-type row type for column_syntax with a maximum of 72 characters. Also, before Release 6.10, if you used the DISTINCT addition for dynamic access to pool tables or cluster tables, this was ignored, but since release 6.10, this causes a known exception.
    If column_syntax is an internal table with header line, the table body and not the header line is evaluated.
    Example
    Read out how many flights go to and from a city. The SELECT command is implemented only once in a sub-program. The column data, including aggregate function and the data after GROUP BY, is dynamic. Instead of adding the column data to an internal l_columns table, you could just as easily concatenate it in a character-type l_columns field.
    PERFORM my_select USING `CITYFROM`.
    ULINE.
    PERFORM my_select USING `CITYTO`.
    FORM my_select USING l_group TYPE string.
    DATA: l_columns TYPE TABLE OF string,
    l_container TYPE string,
    l_count TYPE i.
    APPEND l_group TO l_columns.
    APPEND `count( * )` TO l_columns.
    SELECT (l_columns)
    FROM spfli
    INTO (l_container, l_count)
    GROUP BY (l_group).
    WRITE: / l_count, l_container.
    ENDSELECT.
    ENDFORM.
    SELECT - aggregate
    Syntax
    ... { MAX( col )
    | MIN( col )
    | AVG( col )
    | SUM( col )
    | COUNT( DISTINCT col )
    | COUNT( * )
    | count(*) } ... .
    Effect
    As many of the specified column labels as you like can be listed in the SELECT command as arguments of the above aggregate expression. In aggregate expressions, a single value is calculated from the values of multiple rows in a column as follows (note that the addition DISTINCT excludes double values from the calculation):
    MAX( col ) Determines the maximum value of the value in the column col in the resulting set or in the current group.
    MIN( col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
    AVG( col ) Determines the average value of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    SUM( col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    COUNT( DISTINCT col ) Determines the number of different values in the column col in the resulting set or in the current group.
    COUNT( * ) (or count(*)) Determines the number of rows in the resulting set or in the current group. No column label is specified in this case.
    If you are using aggregate expressions, all column labels that are not listed as an argument of an aggregate function are listed after the addition GROUP BY. The aggregate functions evaluate the content of the groups defined by GROUP BY in the database system and transfer the result to the combined rows of the resulting set.
    The data type of aggregate expressions with the function MAX, MIN or SUM is the data type of the corresponding column in the ABAP Dictionary. Aggregate expressions with the function AVG have the data type FLTP, and those with COUNT have the data type INT4. The corresponding data object after INTO or APPENDING has to be selected accordingly.
    Note the following points when using aggregate expressions:
    If the addition FOR ALL ENTRIES is used in front of WHERE, or if cluster or pool tables are listed after FROM, no other aggregate expressions apart from COUNT( * ) can be used.
    Columns of the type STRING or RAWSTRING cannot be used with aggregate functions.
    When aggregate expressions are used, the SELECT command makes it unnecessary to use SAP buffering.
    Null values are not included in the calculation for the aggregate functions. The result is a null value only if all the rows in the column in question contain the null value.
    If only aggregate expressions are used after SELECT, the results set has one row and the addition GROUP BY is not necessary. If a non-table type target area is specified after INTO, the command ENDSELECT cannot be used together with the addition SINGLE. If the aggregate expression count( * ) is not being used, an internal table can be specified after INTO, and the first row of this table is filled.
    If aggregate functions are used without GROUP BY being specified at the same time, the resulting set also contains a row if no data is found in the database. If count( * ) is used, the column in question contains the value 0. The columns in the other aggregate functions contain initial values. This row is assigned to the data object specified after INTO, and unless count( * ) is being used exclusively, sy-subrc is set to 0 and sy-dbcnt is set to 1. If count( *) is used exclusively, the addition INTO can be omitted and if no data can be found in the database, sy-subrc is set to 4 and sy-dbcnt is set to 0.
    if helpful reward points

  • CR 4 Ent, Xcelsius and WebI - one query and two different results

    Dear Sirs,
    I'm using BO 4.0 platform and 3 tools: Crystal Reports for Enterprise, WebI and Dashboard Design (Xcelsius).
    I have one question, because in my opinion in this solution is one inconsistency.
    I have one table in SQL Server (like below):
    IDRec (autoinc)  | Col1 (varchar)   | Col2 (int)
    1      A    1
    2      A    1
    3      B    2
    4      B    2
    I have one universe with ONLY 3 dimensions (IDRec, Col1, Col2). I haven't any measures.
    And:
    1. Using CR 4 Ent and I create report using 3 dimensions (IDRec, Col1, Col2).
    I make sure, that I selected option: "Retrieve duplicate rows"
    If I have 3 columns in details I have 4 records (4 rows) in my report, when I have 2 columns (Col1 Col2) I have only 2 records (2 rows) in report (Page view).
    So universe (or something like this) use option DISTICT (I think).
    2. When I use WebI (14.0.2) I have the same situation.
    3. When I use Dashboard Desigm (Xcelsius 2011) I have 4 rows !!!  ALWAYS - it doesn't matter I selected "Retrieve duplicate rows" or not  !!!
    When I look to "View script" window, I not see DISTINCT clause.
    Am I doing something wrong?
    I can change the settings so as to be able to see duplicate records?
    It's very important for some calculation, especially in Crystal Reports (for Enterprise).

    Hi,
      Thanks for the response...But the result is deviating from the expected..
           expected is
         if we have first query returns              second query returns
                  1                                                     4
                  2                                                     5
                  3                                                     6
         these two queries result should be in one table , with first query result in first column and second query result in second column.
       The two queries fetching data from same table(category table as in my post) with different search criteria( in where clause).......Regards,
    Rakesh.

  • Query and selection fields

    Hi,
    I'm creating a query with trx SQ01.
    I want to modify the name of a field in the selection screen of the query.
    How can I do this ?
    Regards

    Hi,
    In SQ01 select query and choose icon "change".
    In the change query screen choose from top menu "goto", followed by "field selection" and "selections". In column "No" you can set sequence, in columns "selection text" you can amend the descriptions.
    Hope it will solve ur problem

  • SAP Query and selection screen fields

    Hi,
    I am currently modifying a Query. I have added a new selection field. The fieldname for this selection field has been autogenerated within the query and I have pasted a bit in here:
    SELECT-OPTIONS SP$00015 FOR ZERROR_FLG LOWER CASE.
    SELECT-OPTIONS SP$00022 FOR KNA1-ERDAT.
    SELECT-OPTIONS SP$00023 FOR KNA1-ERNAM.
    SELECT-OPTIONS SP$00027 FOR ZLOEVM LOWER CASE.
    SELECT-OPTIONS SP$00030 FOR ZPARTNERNO
    NO INTERVALS NO-EXTENSION.
    I relation to this select -option, I want to execute a few lines of code that only is executed if the user has filled in a value in teh ZPARTNERNO field. However, no matter if I use the field name ZPARTNERNO or SP$00030 it has no effect.
    Any good ideas ?

    HI,
    In the AT SELECTIOn-SCREEN event, you can write the code
    IF not <b>SP$00030[]</b> is initial.
    write the code which you want to execute before the output
    ENDIF.
    if you want in START-OF-SELECTION>
    IF not <b>SP$00030[]</b> is initial.
    write the code which you want to execute before the output
    ENDIF
    Regards
    Sudheer

  • Workflows and select query

    hi all....
    i want to write a select query in workflow to fetch value from a table which i will be saving in workflow container... i cannot create a business object.... what else can i do... i dont hav exp with classes too.... advise some easy way out.....
    <Thread moved from ABAP General>
    Edited by: Mike Pokraka on Aug 27, 2008 12:47 PM

    Hello Sharma,
    Write a program in which you can give your select query and call the FM, SWU_START_WORKFLOW
    e.g.:
    CALL FUNCTION 'SWU_START_WORKFLOW'
      EXPORTING
        task                  = task
    *   LANGUAGE              = SY-LANGU
        user                  = user
    *   SENDER_ID             = SENDER_ID
    * IMPORTING
    *   RETURN_CODE           = RETURN_CODE
    *   WORKITEM_ID           = WORKITEM_ID
      TABLES
    *   CONTAINER             = CONTAINER
    *   MESSAGE_LINES         = MESSAGE_LINES
        attachment_list       = attachment_list
    Here, in the CONTAINER, pass the workflow container values.
    Give the respective task number and user as sy-uname.
    Regards
    Indu

Maybe you are looking for