Grouping the data

Hello team,
I have come up with a question at my work.
I have a table that has several fields. When I group the data with one field, I get some counts which are equal to the original count of field before grouping. As I add more fields to the query and I add to my grouping, the my total count wouldn't be equal
to the original count of the column.
Can somebody please this?
What query can take care of this?
I generated this select statement, but it didn't work.
SELECT DISTINCT c.code, c.Approved, Year(b.Date) AS [Year], Month(b.Date) AS [Month]
FROM (SELECT a.Code, Sum(a.Approved) AS Approved FROM [MyTable1] AS a WHERE (((a.Approved)>0)) GROUP BY a.Code) 
AS c INNER JOIN [MyTable2] AS b ON c. code = b. Code;
Regards,
GGGGGNNNNN
GGGGGNNNNN

Hi GGGGGNNNNN,
I am not bale to understand the count of field means. Did it mean the numbers of records? If I understand correctly, I think the result is expected since the group by clause is changed.
Here are some articles about SQL in Access for your reference:
SELECT Statement (Microsoft Access SQL)
GROUP BY Clause (Microsoft Access SQL)
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • To group the data by checking the year

    I need to design a report with details based on year.i have employee details with their date of join.I want to display the fields by grouping the year alone.For eg employees joined in the year 2000,2001,2002 etc.Like this i have to display.How to check the year alone?(not like getting date as input)

    You can extract  year from the filed 'date of join ' and put it in another internal table together with employee id . and sort the internal table by year . you can use this sorted internal table for printing

  • Grouping the data in Spread sheet component in xcelsius

    Hi,
    I need to know how to perform grouping of data inside the spread sheet table
    For Eg:
    Category             Profit                    Loss
    [+]Manufacturing    10                            5
    [+]Retail                    70                           0
    Here i get the aggregate total of category
    If i expand the "manufacturing category", it could see tyres,products, cars list below
    Category             Profit                    Loss
    [-]Manufacturing    10                            5
    tyres                       5                              1
    Products                 3                              2
    cars                         2                             2
    Can u tel me how to implement this in the Spreasheet componet.
    Note: Can you tel me how to post the attachment,
    Regards,
    Abi

    Hi Prasad,
    Thanks a lot for ur earlier response.
    It solved my queries.
    Regards,
    abirami.

  • Is it possible to filter the data in a rule group ?

    Hi !
    I'm using 3 rule groups in a sales transformation to differentiate commands, bills, and deliveries.
    I would like to know if it is possible to filter for each rule group the data by BWVORG for example ?
    Thx in advance .
    Guillaume

    As per my understanding filter at rule group is not possible.
    You can use the same at the start routine.

  • Grouping of data based on user prompt having a list of dimensions

    Hi All,
    I have a requirement to be able to group data in OBIEE request or Dashboard based on user prompt selection.
    The prompt should list the Dimensions Available
    e.g.
    Dimensions: Product, Region, Employee
    Fact: Sales
    The report is to display sales total for the quarters of the current year.
    The user prompt should list the available dimensions (In this case - Location, Employee and Product).
    If I choose Product, the data is to be grouped by Products - Layout having a simple tabular grouping with Product names as Group headings.
    Similarly any other choice of Dimension from the prompt should group the data by that dimension and have the dimension values used in the group headings.
    How could we implement this? I understand this type of requirement (ability to choose dimension) is met in some OLAP reporting tools.
    I have used multiple views and the View Selector for similar requirements previously, but looking for a dynamic solution here.
    Any pointers or solution will be great.
    Thanks,
    Kiran
    Edited by: Kiran Kudumbur on Sep 8, 2009 5:43 PM
    Edited by: Kiran Kudumbur on Sep 9, 2009 12:42 PM
    Edited by: Kiran Kudumbur on Sep 10, 2009 2:26 PM

    Hi All,
    I used column view to address this requirement.
    Thanks,
    Kiran

  • Grouping of Data in Advanced Datagrid

    Hii,
    I need to group the data in advanced datagrid. I used the Grouping collection class, but it it not working.
    My advanced datagrid has column groups...so will this have any impact on grouping.
    Thanks!!
    Vikas

    Assuming that the table (say WALK_IN_PER_LOG) that you have has atleast the following two columns
    walk_in_date DATE -- holds date time stamp
    dob DATE -- holds date of birth
    SELECT TO_CHAR(walk_in_date,'WW')| |'-'| |TO_CHAR(walk_in_date,'DAY') "Week#-Day"
    ,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')| |'-'| |
    TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
    ,COUNT(*)
    FROM walk_in_per_log
    WHERE MONTHS_BETWEEN(SYSDATE,dob) > 18*12
    GROUP BY TO_CHAR(walk_in_date,'WW')| |'-'| |TO_CHAR(walk_in_date,'DAY')
    ,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')| |'-'| |
    TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
    PS I might have complicated the query a little in trying to get the formatting as you had requested but the principle is simple
    First group by the day, so that all events of one day can be compared together, then extract the hour portion of each of those dates and divide by 2 and use the quotient of the division as a grouping factor.
    eg
    from hours
    00-02 the quotient is 0 (2 is taken as 1:59:59)
    02-04 the quotient is 1 (4 is taken as 3:59:59)
    and so on
    hope this helps....

  • Splitting and grouping of data from incoming string

    Hello,
    I have a package of data coming from the serial port and read out as a string.
    The package has the following format, to be short.
    1. opening characters
    2. 2 bytes for Group ID(identify the device# the data comes from).
    3. Sensors data belongs to device# (1 byte each)
    -data of sensor #1
    -data of sensor #2
    -data of sensor #3
    -data of sensor #4
    and loop back to sensor 1,2,3,4 for 20 bytes total.
    I have eliminated the opening characters with the replace substring with empty string. For the Group ID, I used a case structure to identify which device it is. For the sensor data, I need to split them up and group all the data of the sensors together. I tried using substring for each sensor in a for loop that loop 5 times to group the data of each sensor together but it only give me the very last values.
    My goal is to be able to extract and group the 5 bytes of each sensor together everytime the serial package comes in and then save them to a separte files for each sensor. I also want to be able to plot the data of each sensor as they come in with respect to time.
    Any idea on how I can accomplish the grouping of data described above? I really appreciate your prompt response. Thanks,

    Since you already know how to separate the sting containing the sensors data, you just have to use a string to byte function and to decimate the resulting array, as shown in the attached vi.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Sensor data.vi ‏39 KB

  • Grouping a data small datetime

    Hi guys, I got data that come from Oracle, finally I got a good structure , everything is good but this issue:
    203 2013-04-18 14:45:19.0000000  100
    203 2013-04-18 14:45:25.0000000    85
    just as sample, I shoud group th id 203 as
    203 2013-04-18 185
    I tried with convert, cast, day, year and everything but always the result is splitted in two rows. I don have idea at the moment how I can group the data from thet format to another format ( but more important I don't want the 203 splitted and in the same
    time I need the data...)
    Any advice? Thanks

    Can you give us the DDL+DML?
    Did you try this query?
    select id,CAST(CAST(currentdate as varchar(11)) as date),SUM(cnt) from @T
    group by id,CAST(CAST(currentdate as varchar(11)) as date)
    --Prashanth

  • How to group the elements?

    Hello experts,
    I am new to BI publisher and below is the requirement given to me. Please help me on this.
    Below is my sample xml
    <MainRow>
    <Row>
    <dept_rank>1</dept_rank>
    <dept_id> AAA</dept_id>
    <dept_name> sales </dept_name>
    <expenses> 1000.45 </expenses>
    <sales> 5000 </sales>
    </Row>
    <Row>
    <dept_rank>2</dept_rank>
    <dept_id> BBB</dept_id>
    <dept_name> Procurement </dept_name>
    <expenses> 1000.45 </expenses>
    <sales> 5000 </sales>
    </Row>
    <Row>
    <dept_rank>3</dept_rank>
    <dept_id> CCC</dept_id>
    <dept_name> Marketing </dept_name>
    <expenses> 1000.45 </expenses>
    <sales> 5000 </sales>
    </Row>
    <Row>
    <dept_rank>4</dept_rank>
    <dept_id> DDD</dept_id>
    <dept_name> Marketing </dept_name>
    <expenses> 1000.45 </expenses>
    <sales> 5000 </sales>
    </Row>
    </MainRow>
    Now I have to group the data on the dept_name and below link has desired output format
    http://img707.imageshack.us/i/outputr.jpg/
    Thanks

    Can you please post the exact output in text format?
    From image requirement is not clear.

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • FI:where to maintain the data of "Group account number"?

    Hi.When I use the T-CODE FS00 to create G/L account,the sap require me to Make an entry in field "Group account number".But when I press F4 on the field "Group account number",the sap tell me there is no values.So I need to maintain the data of "Group account number".But I don't know where to maintain the data of "Group account number".So I need someone give me the T-CODE or some advice.Thanks so much.

    Hi,
    You have activated group account number. If you have any grp account number of your company please provide the group company account number.
    Else if you dont want to give group account number
    In T-code: OB13 remove group chart of accounts from your chart of accounts
    Best Regards
    Ashish Jain
    Message was edited by:
            Ashish Bohara

  • How to see target groups in Data Target in the APD

    Hi everybody.
    I am trying to make a marketing segmentation of customers in the APD (BI) and I need to send the results to a target group in CRM, my problem is that I can´t see target groups in the u201CData Target CRMu201D.
    I select the Logical System and when I select the Data Target the system shows   CRM error: Data target TARGET_GROUP_FROM_B not known.
    I know that the communication is OK, the RFC is working cause I can see Marketing Attributes (I released data target for replication and maintained attributes) but I don´t know if I need to do something similar with Target Groups of CRM or how.
    Does anyone have an idea how can I see target groups in the window of the Data Target?
    Thanks.

    Hello,
    I have seen  this problem in other systems and it was caused by a GUI bug. Can you please check that you have the latest GUI patch installed for your GUI  release.
    Best Regards,
    Des

  • Grouping of Individual groups of Data Template in the RTF

    Hi All,
    We have a scenario where we may require the grouping of Individual groups of Data Template in the RTF.
    Lets say
    1. I have group of Invoices with the Group Name G_INV
    2. I have a list of Payments done for the Invoices under G_PAY
    3. I also have a list of Prepayment Applications that are happened on the Invoices G_PRE
    All the three groups G_INV, G_PAY, and G_PRE are independent and they are at same level
    G_INV (Main Header)
    G_PAY (Main Header)
    G_PRE (Main Header)
    Extract
    <ROOT>
    <G_INV>
    <INV>I1</INV>
    </G_INV>
    <G_INV>
    <INV>I2</INV>
    </G_INV>
    <G_INV>
    <INV>I3</INV>
    </G_INV>
    <G_PAY>
    <PAY>P1</PAY>
    <INV>I1</INV>
    </G_PAY>
    <G_PAY>
    <PAY>P2</PAY>
    <PAYINV>I2</PAYINV>
    </G_PAY>
    <G_PRE>
    <PRE>PRE1</PRE>
    <PREINV>I1</PREINV>
    </G_PRE>
    </ROOT>
    But in the Report output,
    we need the data to be displayed as follows
    G_INV (Main Header)
    G_PAY (Sub Group of Payments)
    G_PRE (Sub Group of Prepayments)
    Output
    I1
    P1
    PRE1
    I2
    P2
    I3
    So, Can you please suggest us,
    Whether we can get these Individual groups into the above required hierarchical manner. If so, please let us know how to achieve the same.
    Also, it will be great if you advice us regarding the Performance, how best will be if we group the queries in this heirarchical manner in the RTF rather than getting the hardcoded dependency through linking of the Data Queries in the Data Template file.
    Thanks,
    Praveen G

    Hi
    I dont think you can stop the table growing using Word controls. The easiest way to do it would be to limit the amount of data coming in.
    <?for-each:LOOPELEMENT[position()<5]?>
    This is take only the first 5 rows
    Tim

  • How to send the data to SQL server group in Reciever JDBC scenario

    Hi Experts,
    I have done IDOC to JDBC scenario, the data is successfully going to SQL server in reciever side, but in reciever side they got local server and other server groups also there, the data ia m sending is going to local server group, so where can i mention the other server group name in reciever JDBC adapter.
    Kind Regards,
    Praveen.

    Hi,
    Except if there is a way to specity this in the URL field (either using a suitable properties or a specific syntax), I do not see such feature in the JDBC adapter ... I'm not familiar with SQLServer group concept, but maybe you could use multiple receivers instead ?
    So far, I haven't been able to see how to use groups in the URL ... Maybe there is way to trigger replication at SQLServer level ? Stored proc ?
    Chris
    Edited by: Christophe PFERTZEL on Dec 9, 2009 11:26 AM

  • How do I check to see if a channel group exists in the data portal?

    I have a list of channel groups in the data portal but sometimes some channel groups  are not created all the time.  How do I check using a script if a channel group exists or was created.

    Hello jreynolds!
    With the command 'GroupIndexGet'. It returns 0 if the group does not exist.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

Maybe you are looking for

  • How do I switch my current Thunderbird mail account from IMAP to POP3

    I have an HP computer Windows 7 iphone 5 ipad 2 Thank you in advance, Art

  • F4 Help to get the path for a File source directory

    There are numerous function modules for browsing a particular file in desktop and getting the file path (including the fine name)  , like F4_FILENAME , KD_GET_FILENAME_ON_F4 , WS_FILENAME_GET etc. But can anyone tell me how to fetch only the director

  • Unable to add value to model node with cardinality 0..n

    Hi All,    Im working with Webdynpro Java.i have an issue here.i have a input field item named customer and a drop down box item location.when i give customer and location as inputs,a WSDL (named Equipment WSDL) is called.the result is a  drop down l

  • XI Security Documents

    Hi, does anybody know about documents refering to SAP XI security. I would like to know internals, e.g. how configured passwords are stored. Kind regards, Heiko

  • Query on Material Ledger

    Hi All, Configuration settings: 1. Movement Type (MT) 201 is assigned to Movement Type Group(MTG) CC to revalue FI/CO accounts 2. MT 202 is not assigned to any MTG Scenario: 1. Post MT 201 to cost center 2. Post MT 202 to cost center(reversal) 3. Run