Summing logical results from a table

Dear all
Here is my problem. I have a spreadsheet with people's menu choices: 3 of each starter, main and dessert, as drop-down boxes. I want to now sum how many of each of the 27 possible choices have been made (see below):
DUCK
LAMB
MOUSSE
DUCK
LAMB
PAVLOVA
DUCK
LAMB
MOUSSE
DUCK
LAMB
MOUSSE
DUCK
SALMON
PAVLOVA
TART
LAMB
TART
DUCK
LAMB
PAVLOVA
DUCK
LAMB
TART
DUCK
LAMB
TART
DUCK
LAMB
PAVLOVA
DUCK
LAMB
TART
DUCK
LAMB
TART
TART
SALMON
MOUSSE
TART
LAMB
TART
TART
RISOTTO
PAVLOVA
I suspect I need an additional column and a comparison table maybe.
=ADD([CELL]="DUCK",[CELL]="LAMB",[CELL]="MOUSSE") works OK, but then I need 27 possibilities, and then to count up (COUNTIF?) the whole spreadsheet. Maybe a really long formula with all possibilities might? Or an AppleScript?
Thanks for any suggestions!
Paul

Hi Barry
I can already count how many of each dish with this:
MENU CHOICES
Starter: Duck 1
49
Starter: Tart 2
22
Starter: Salad 3
17
Main: Salmon 1
19
Main: Lamb 2
56
Main: Risotto 3
13
Dessert: Pavlova 1
40
Dessert: Tart 2
28
Dessert: Mousse 3
20
In the first of the number cells I have:
=COUNTIF($F$3:$F$32, "=DUCK")+COUNTIF($N$3:$N$29, "=DUCK")+COUNTIF($V$3:$V$48, "=DUCK")+COUNTIF($AD$3:$AD$17, "=DUCK")
(it is counting from four parts of the spreadsheet, hence the four COUNTIFs added together)
and so on down.
What I need is how many of each COMBINATION of, e.g. Duck, Lamb, Tart

Similar Messages

  • SUM the COUNT RESULTS from 2 Tables

    If I have 2 seperate queries how can I sum the results of them
    select count(*) from tableA;
    select count(*) from tableB;
    MAXIMO@tarml > select count(*) from tableA;
      COUNT(*)
         500
    MAXIMO@tarml > select count(*) from tableB;
      COUNT(*)
         600
    MAXIMO@tarml > I want a query that gets me the 1100?
    I know people in here will know a simple solution that I can not find on the web?
    Thanks in advance again as always...
    Miller

    You should have read your given link more closely: You would have found
    select ( select count(*) from Table1 )
         + ( select count(*) from Table2 )
              as total_rows
      from my_one_row_table  --<---   replace with dual

  • Finding results from different tables

    Hello,
    I am makeing a query on 2 tables. It works. But I need to find out which result is coming from which table. e.g 1 table is having abc record and 2nd table is having xyz record. I need to find out that abc has come from 1 table and xyz has come from 2nd table. Is it possible? If yes, Please give me a sample code snippet.
    Thanks

    Well one way that I can think of other than duplicating every column is to add one additional column to your select such as a.table1 then only populate the a.table1 column if the data came from the first table (any dba can help you with that since it is database specific). Then you just check for a null in the column in the resultset and will know which table it came from (null = came from table 2, !null = came from table1). Does not matter what data you stick in there as long as it comes from a not null column you should be golden

  • Getting Result from multiple table using code table.

    I am having hard time getting data from different table not directly connected.
    

    The data model is not proper. Why should you store the game details in separate tables?
    IMO its just matter of putting them in same table with additional field gamename to indicate the game. That would have been much easier to query and retrieve results
    Anyways in the current way what you can do is this
    SELECT p.ID,p.Name,c.CategoryName AS [WinnerIn]
    FROM GameParticipants p
    INNER JOIN (SELECT ParticipantID, Value AS ParticipantName,'CGW Table' AS TableName
    FROM CGWTable
    UNION ALL
    SELECT ParticipantID, Value AS ParticipantName,'FW Table' AS TableName
    FROM FWTable
    SELECT ParticipantID, Value AS ParticipantName,'WC Winner' AS TableName
    FROM WCWinner
    ... all other winner tables
    )v
    ON v.ParticipantID = p.ID
    AND v.ParticipantName = p.Name
    INNER JOIN Category c
    ON c.TableName = v.TableName
    If you want you can also add a filter like
    WHERE p.Name = @Name
    to filter for particular player like Henry in your example
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Update column based on sum of data from another table

    Hi We had two tables.
    Table 1: matusetrans
    ITEMNUM Location Quantity transdate
    AM1324 AM1 2 12-4-12
    AM1324 AM1 2 15-5-12
    AM1324 AM1 3 10-6-12
    AM1324 AM1 4 5-1-13
    AM1324 AM1 2 13-3-13
    AM1324 AM2 3 2-5-12
    AM1324 AM2 2 12-7-12
    AM1324 AM2 1 13-2-13
    Table 2: Inventory
    ITEMNUM STORELOC lastyear currentyear
    AM1324 AM1 need sum(quantity) here need sum(quantity)
    AM1324 AM2 need sum(quantity) here need sum(quantity)
    We have to update the last year and current year columns with sum of quantities for each item from matusetrans table based on date at different location in Inventory table.
    we had nearly 13,000 records(itemnum's with different location) in inventory table in DB we have to update entire records.
    Any help...How to write an sql queries to update lastyear and currentyear columns with sum of quantities based on itemnum and location in Inventory table
    Thanks
    Edit/Delete Message

    Try this
    SQL> select * from matusetrans;
    ITEMNU LOC   QUANTITY TRANSDATE
    AM1324 AM1          2 12-APR-12
    AM1324 AM1          2 15-MAY-12
    AM1324 AM1          3 10-JUN-12
    AM1324 AM1          4 05-JAN-13
    AM1324 AM1          2 13-MAR-13
    AM1324 AM2          3 02-MAY-12
    AM1324 AM2          2 12-JUL-12
    AM1324 AM2          1 13-FEB-13
    8 rows selected.
    SQL> select * from inventory;
    ITEMNU STO   LASTYEAR CURRENTYEAR
    AM1324 AM1          0           0
    AM1324 AM2          0           0
    SQL> merge into inventory i
      2  using (
      3            select itemnum
      4                 , location
      5                 , sum(decode(extract(year from transdate), extract(year from sysdate), quantity)) currentyear
      6                 , sum(decode(extract(year from transdate), extract(year from add_months(sysdate, -12)), quantity)) lastyear
      7              from matusetrans
      8             group
      9                by itemnum
    10                 , location
    11        ) t
    12     on (
    13           i.itemnum  = t.itemnum and
    14           i.storeloc = t.location
    15        )
    16  when matched then
    17    update set i.lastyear = t.lastyear
    18             , i.currentyear = t.currentyear
    19  /
    2 rows merged.
    SQL> select * from inventory;
    ITEMNU STO   LASTYEAR CURRENTYEAR
    AM1324 AM1          7           6
    AM1324 AM2          5           1
    SQL>

  • How to Get the Unique Key results from OWB Tables after Profile

    Hi,
    We are using OWB 10gR2(Paris) Beta Version.
    In this version the new feature is introduced is Data Profiling.
    We are using this feature to analylize the data in terms of stanadards.
    We have done profiling for our tables and we are able to see the results for each table in OWB Profile Results Canvas. In this window one Unique Key tab is there to see the Unique results.
    Now my question is where these results will be stored in standard tables of OWB. I want to know those exact standard tables to extract thoes Unique results in to my reports.
    After profiling we are generating HTML-DB reports to view all these profile results. But we are not able to find the Uique Key tables where these results are stored.
    So pls can anybody provide help on this to get these tables...
    Thanks in advance...,
    Ramesh P.

    You can use DatabaseMetaData#getPrimaryKeys.

  • Reading latest payroll run results from CRT table

    Please find below my code to retrieve the cluster table crt.
    Could you please let me know which HR report category I need to assign while giving the attributes in executable program. I am novice in this area, I didnu2019t even know whether we need to give the hr report category or not.
    I am not able to see the selection screen with pernr input though I gave the pnp logical database in the attributes of my executable program.
    tables: PERNR.
    data: payresult TYPE table of pay99_result,
          wa_payresult type pay99_result.
    data: it_rgdir like table of PC261,v_seqnr type pc261-seqnr,wa_rgdir
    type pc261,
          v_clusterid like pcl2-relid value 'RX',v_betrg type pc208-betrg.
       data begin of crt occurs 0.
          include structure pc208.
        data end of crt.
    get pernr.
    if pnp-sw-found = 1.
    CALL FUNCTION 'CU_READ_RGDIR_NEW'
      EXPORTING
        PERSNR                      = pernr-pernr
      CHECK_READ_AUTHORITY        = 'X'
      IMP_CLIENT                  =
    IMPORTING
      MOLGA                       =
      TABLES
        IN_RGDIR                    = it_rgdir
    EXCEPTIONS
      NO_RECORD_FOUND             = 1
      IMPORT_MISMATCH_ERROR       = 2
      NO_READ_AUTHORITY           = 3
      OTHERS                      = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    sort it_rgdir DESCENDING.
    read table it_rgdir into wa_rgdir index 1.
    v_seqnr = wa_rgdir-seqnr.
    CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
      EXPORTING
       CLUSTERID                          = v_clusterid
        EMPLOYEENUMBER                     = pernr-pernr
        SEQUENCENUMBER                     = v_seqnr
      CHANGING
        PAYROLL_RESULT                     = payresult.
    IF SY-SUBRC <> 0.
    ENDIF.
    loop at payresult into wa_payresult.
      loop at crt.
         if crt-lgart = '\405' and crt-CUMTY ='Y'.
           V_BETRG = CRT-BETRG.
           write:/' payroll result amt',v_betrg.
           EXIT.
          ENDIF.
       ENDLOOP.
    ENDLOOP.
    endif.

    Hi Maqsood.
    In attributes section section.
    first tick on the Master data(infotypes) and leave it blank....... and save it.......
    secondly go in to your code.
    comment all your code except.
    tables: pernr.
    now check if the selection screen is coming with pernr or not...
    Thanks
    Saurabh

  • Dificulty in displaying results from 2 tables

    Hi Experts,
    I have created a form that needs to display 2 different tables in the form. However, the second table only shows the results after all the records from the first are listed. I need to show both the tables in page 1 and continue to show the records in the succeeding pages. I have put the tables each in their different subforms and enclosed them in another subform but the entries from table 2 still does not show. Could you tell me what am I missing?
    Thanks and more power.
    Regards,
    Rare

    Hi,
    What is the cardinality of the nodes that these tables are mapped to?
    Is it 1..n or 0..n?
    If it is 0..n then this is where the problem may be..
    Try setting the minimum count of the second table to 1 in the binding tab in the livecycle designer..
    Also, make sure the paginatinof the two sub forms is set to Flowed..
    Hope this helps.
    Rgds, Amith

  • How merge query results from joined table into one additional column

    <code>
    Here is example
    TABLE A:
    id | value
    1 | a
    2 | a
    3 | b
    TABLE B
    id | id_in_table_a | value
    1 | 1 | d
    2 | 1 | e
    3 | 2 | g
    </code>
    this select should get all columns from table A where value = 'a' and all values related to this record from B merged to one column separated for example with pipe, so the output should looks like this
    <code>
    id | value | merged_column
    1 | a | d|e
    2 | a | g
    </code>
    thanks for help

    If you are on 10g, you can use this:
    SQL> create table a
      2  as
      3  select 1 id, 'a' value from dual union all
      4  select 2, 'a' from dual union all
      5  select 3, 'b' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table b
      2  as
      3  select 1 id, 1 id_in_table_a, 'd' value from dual union all
      4  select 2, 1, 'e' from dual union all
      5  select 3, 2, 'g' from dual
      6  /
    Tabel is aangemaakt.
    SQL> select id
      2       , value
      3       , rtrim(v,'|') merged_column
      4    from ( select id
      5                , value
      6                , v
      7                , rn
      8             from a
      9                , b
    10            where a.id = b.id_in_table_a
    11            model
    12                  partition by (a.id)
    13                  dimension by (row_number() over (partition by a.id order by b.id) rn)
    14                  measures (a.value, cast(b.value as varchar2(20)) v)
    15                  rules
    16                  ( v[any] order by rn desc = v[cv()] || '|' || v[cv()+1]
    17                  )
    18         )
    19   where rn = 1
    20  /
       ID VALUE MERGED_COLUMN
        1 a     d|e
        2 a     g
    2 rijen zijn geselecteerd.Regards,
    Rob.

  • Can we make one query to get same results from 3 tables

    CREATE TABLE TABLE1 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE2 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE3 (NODEID VARCHAR2(4));
    INSERT INTO TABLE1 VALUE('1004');
    INSERT INTO TABLE1 VALUE('1004');
    INSERT INTO TABLE1 VALUE('1002');
    INSERT INTO TABLE1 VALUE('1002');
    INSERT INTO TABLE1 VALUE('1001');
    INSERT INTO TABLE1 VALUE('1001');
    INSERT INTO TABLE1 VALUE('1006');
    INSERT INTO TABLE1 VALUE('1006');
    INSERT INTO TABLE1 VALUE('1005');
    INSERT INTO TABLE1 VALUE('1005');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1004');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE2 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1001');
    INSERT INTO TABLE3 VALUE('1001');
    INSERT INTO TABLE3 VALUE('1006');
    INSERT INTO TABLE3 VALUE('1006');
    INSERT INTO TABLE3 VALUE('1005');
    INSERT INTO TABLE3 VALUE('1005');
    INSERT INTO TABLE3 VALUE('1004');
    INSERT INTO TABLE3 VALUE('1004');
    INSERT INTO TABLE3 VALUE('1004');
    INSERT INTO TABLE3 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1002');
    INSERT INTO TABLE3 VALUE('1002');
    Select count(*), count(distinct nodeid)
    from table1, table2,table3
    where table1.nodeid=table2.nodeid and table1.nodeid=table3.nodeid;
    Select count(*), count(distinct nodeid)
    from table1, table3
    where table1.nodeid=table2.nodeid;
    Select count(*), count(distinct nodeid)
    from table2, table3
    where table2.nodeid=table3.nodeid;

    Aside from your insert statements not working... (should be as follows)...
    DROP TABLE TABLE1;
    DROP TABLE TABLE2;
    DROP TABLE TABLE3;
    CREATE TABLE TABLE1 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE2 (NODEID VARCHAR2(4));
    CREATE TABLE TABLE3 (NODEID VARCHAR2(4));
    INSERT INTO TABLE1 VALUES('1004');
    INSERT INTO TABLE1 VALUES('1004');
    INSERT INTO TABLE1 VALUES('1002');
    INSERT INTO TABLE1 VALUES('1002');
    INSERT INTO TABLE1 VALUES('1001');
    INSERT INTO TABLE1 VALUES('1001');
    INSERT INTO TABLE1 VALUES('1006');
    INSERT INTO TABLE1 VALUES('1006');
    INSERT INTO TABLE1 VALUES('1005');
    INSERT INTO TABLE1 VALUES('1005');
    INSERT INTO TABLE2 VALUES('1004');
    INSERT INTO TABLE2 VALUES('1004');
    INSERT INTO TABLE2 VALUES('1004');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE2 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1001');
    INSERT INTO TABLE3 VALUES('1001');
    INSERT INTO TABLE3 VALUES('1006');
    INSERT INTO TABLE3 VALUES('1006');
    INSERT INTO TABLE3 VALUES('1005');
    INSERT INTO TABLE3 VALUES('1005');
    INSERT INTO TABLE3 VALUES('1004');
    INSERT INTO TABLE3 VALUES('1004');
    INSERT INTO TABLE3 VALUES('1004');
    INSERT INTO TABLE3 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1002');
    INSERT INTO TABLE3 VALUES('1002');and you're queries not working...
    SQL> Select count(*), count(distinct nodeid)
      2  from table1, table2,table3
      3  where table1.nodeid=table2.nodeid and table1.nodeid=table3.nodeid;
    Select count(*), count(distinct nodeid)
    ERROR at line 1:
    ORA-00918: column ambiguously definedI'm guessing you want:
    SQL> Select count(*), count(distinct table1.nodeid)
      2  from table1, table2,table3
      3  where table1.nodeid=table2.nodeid and table1.nodeid=table3.nodeid;
      COUNT(*) COUNT(DISTINCTTABLE1.NODEID)
            50                            2You haven't explained to us what database version you are using or what you want the output to look like when these 3 queries are combined.
    Please read: {message:id=9360002} and learn to post a good question, and use {noformat}{noformat} tags to show your code/data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to sum the result from 2 different queries?

    Hi ,
    I would like to add the reslut of the below queries and insert into the status_count column of the temp table called edr_status_by_report_data.
    How could I do that ?
    SELECT         
              COUNT(status_code)
        FROM (SELECT site_id,
                     site_lane_id,
                    (SELECT NVL(MAX(interval_start_date_time), date_time)
                       FROM edr_rpt_tmp_grouping_table
                      WHERE interval_start_date_time <= date_time) bin_start_date_time,
                            TO_NUMBER(TO_CHAR(date_time, 'hh24')) period,
                            vehicle_status  status_code
                       FROM edr_status_by_veh_data
                      WHERE vehicle_error_count = 0                         
                        AND vehicle_status > 0                   
             ) vehicles
    SELECT         
              COUNT(status_code)
        FROM (SELECT site_id,
                     site_lane_id,
                    (SELECT NVL(MAX(interval_start_date_time), date_time)
                       FROM edr_rpt_tmp_grouping_table
                      WHERE interval_start_date_time <= date_time) bin_start_date_time,
                            TO_NUMBER(TO_CHAR(date_time, 'hh24')) period,
                            vehicle_status  status_code
                       FROM edr_status_by_veh_data
                      WHERE vehicle_error_count = 0                         
                        AND vehicle_status = 0                   
             ) vehicles
          ;              

    That just becomes:
    SELECT count(*)
    FROM   (SELECT site_id,
                   site_lane_id,
                   (SELECT NVL(MAX(interval_start_date_time), date_time)
                    FROM   edr_rpt_tmp_grouping_table
                    WHERE  interval_start_date_time <= date_time) bin_start_date_time,
                   TO_NUMBER(TO_CHAR(date_time, 'hh24')) period,
                   vehicle_status status_code
            FROM   edr_status_by_veh_data
            WHERE  vehicle_error_count = 0
            AND    vehicle_status >= 0);Or, if you needed to have both columns separately for some other purpose, you could still get them in one query:
    SELECT COUNT(CASE WHEN status_code > 0 THEN 1) count_gt_zero,
           COUNT(CASE WHEN status_code = 0 THEN 1) count_zero,
           COUNT(CASE WHEN status_code > 0 THEN 1)
             + COUNT(CASE WHEN status_code = 0 THEN 1) total
    FROM   (SELECT site_id,
                   site_lane_id,
                   (SELECT NVL(MAX(interval_start_date_time), date_time)
                    FROM   edr_rpt_tmp_grouping_table
                    WHERE  interval_start_date_time <= date_time) bin_start_date_time,
                   TO_NUMBER(TO_CHAR(date_time, 'hh24')) period,
                   vehicle_status status_code
            FROM   edr_status_by_veh_data
            WHERE  vehicle_error_count = 0
            AND    vehicle_status >= 0);

  • Details from fact table as dimension - solution review needed

    Hi experts,
    I found a convinient way to display details from fact table, as a dimension and need your opinion. Do you see any potential issues about this solution?
    Context
    - I use vertical federation in OBIEE 11.1.1.6
    - all aggregated measures are in OLAP
    - there is a need that user drill down to lowest level details (single fact row) -> this information is in relational database
    - we decided to use dedicated presentation hierarchy column and let users drill to lowest level detail (just 2 hierarchy levels "All" -> "Detail")
    - always add this column at the right side of report table and after all other dimension drills are in place (other table columns are also presentation hierarchy), user can drill to contract ID (the detail)
    Solution (I tested it and it seems to works ok)
    - create "dummy" relational table with just 1 row ("All" level in hierarchy), linked to fact table (to "dummy" ID column in fact table)
    - create "dummy" dimension in Analytic Workspace
    - in BMM create logical table with 2 data sources: OLAP for hierarchy level "All" (linked to dummy OLAP dimension) and relational for hierarchy level "Detail" (using relational fact table)
    - so in BMM we have additional logical dimension with 2 levels - one "All" that read from OLAP, and does not impact performance, and second "Details" that is the only information at all that is obtained from relational database when user expand "All"
    - Why created "dummy" dimension? -> because OBIEE won't let me create logical dimension from fact table columns, but can create a dummy dimension with just "All" level and add to it column from fact table
    Any comments are welcome.

    hi,
    The exact data will be hard to give however you can reach at a round figure in your case.
    You are consolidating the data from the tables that means that there is relation between the tables. Arrive at a rough figure based on the relation and the activity you are performing while consolidating the data of the tables.
    For example, let us say we want to combine data for sales order and deliveries in a DSO.
    Let Sales order has 1000 records and Delivery has 2000 records. Both the tables have a common link (Sales Order).In DSO you are combining the data that means the data will be at the most granular level consist of Delivery data, so the maximum no of records which the consolidated DSO can have is 2000.
    regards,
    Arvind.

  • Need Logic for Inserting data into table from another table

    Hi,
    Could you please give me some logic on below:
    TABLE_A has columns A,B,C,D
    What i did
    ==========
    Created new table
    TABLE_1_A with columns A1,A2,B1,B2,B3
    Requirement
    ===========
    I should populate columns A1,A2 (table TABLE_1_A) with the data from column A (table TABLE_A)
    & simillarly populate columns B1,B2 with the data from B.
    the data is huge in the table_a.
    Database: 10g
    Thanks.

    Hi,
    Here's one way:
    INSERT INTO  table_1_a
            (a1, a2, b1, b2)
    SELECT      a,  a,  b,  b
    FROM      table_a
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    If you're asking about a DML statement, such as INSERT, the sample data will be the contents of the table before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    See the forum FAQ {message:id=9360002}

  • Compare two results from the same table

    i have two results from the same table that i would like to compare. below is my query and the results i want to compare
    SELECT tblItemRoutingBOM.ItemRevID, tblItem.ItemID, tblItem.PartNum, tblItem.ItemName, tblItem.ManufacturerPartNum AS [Mfg Part#], tblItemRoutingBOM.Quantity
    FROM tblItemRouting
    INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
    INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
    WHERE tblItemRoutingBOM.ItemRevID in (61,70)
    as you can see i am returning two records using the where clause
    ItemRevID, ItemID, PartNum, ItemName, Manufacturer, Mfg Part#, Quantity
    61,121,331503,.233 Aluminum Sheet,,1
    70,121,331503,.233 Aluminum Sheet,,3
    now what i am looking for is to combine these two together into one row with the following added.  two columns for each QTY, QTY1 = 1 and QTY2 = 3 with a third column added that is the difference between the two QTY Diff = 2
    Any thoughts?

    Here are the two statements that i want to combine, results for each are attached
    SELECT tblItem.ItemID, Sum(tblItemRoutingBOM.Quantity) AS SumOfQuantity, tblItem.PartNum AS [Part #],
    tblItem.ItemName, tblManufacturer.ManufacturerName AS Manufacturer, tblItem.ManufacturerPartNum AS [Mfg Part#]
    FROM tblItemRouting
    INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
    INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
    INNER JOIN tblUnits ON tblItem.UnitID = tblUnits.UnitID
    LEFT JOIN tblManufacturer ON tblItem.ManufacturerID = tblManufacturer.ManufacturerID
    WHERE tblItemRoutingBOM.ItemRevID=61
    GROUP BY tblItem.ItemID,tblItem.PartNum,tblItem.ItemName,tblManufacturer.ManufacturerName,tblItem.ManufacturerPartNum
    SELECT tblItem.ItemID, Sum(tblItemRoutingBOM.Quantity) AS Quantity, tblItem.PartNum AS [Part #],
    tblItem.ItemName, tblManufacturer.ManufacturerName AS Manufacturer, tblItem.ManufacturerPartNum AS [Mfg Part#]
    FROM tblItemRouting
    INNER JOIN tblItemRoutingBOM ON tblItemRouting.ItemRoutingID = tblItemRoutingBOM.ItemRoutingID
    INNER JOIN tblItem ON tblItemRoutingBOM.ItemID = tblItem.ItemID
    INNER JOIN tblUnits ON tblItem.UnitID = tblUnits.UnitID
    LEFT JOIN tblManufacturer ON tblItem.ManufacturerID = tblManufacturer.ManufacturerID
    WHERE tblItemRoutingBOM.ItemRevID=70
    GROUP BY tblItem.ItemID,tblItem.PartNum,tblItem.ItemName,tblManufacturer.ManufacturerName,tblItem.ManufacturerPartNum
    114,11,55002,Pepsi Blue Cap,NULL,
    117,5,331501,Marigold Yellow For ABS,NULL,
    121,1,331503,.233 Aluminum Sheet,NULL,
    125,2,331504,Velvet Vinyl .008,NULL,
    114,33,55002,Pepsi Blue Cap,NULL,
    117,15,331501,Marigold Yellow For ABS,NULL,
    121,3,331503,.233 Aluminum Sheet,NULL,
    125,6,331504,Velvet Vinyl .008,NULL,
    my returned result should combine above with two extra columns (two extra columns because i have two results to combine)
    114, 11, 33, 22, 55002, Pepsi Blue Cap, NULL,
    117, 5, 15, 10, 331501, Marigold Yellow For ABS, NULL
    121,1, 3, 2, 331503, .233 Aluminum Sheet, NULL
    125, 2, 6, 4, 331504, Velvet Vinyl .008, NULL
    Columns go as such, ID, QTY1 (for 61), QTY2 (for 70), Diff (QTY1-QTY2), PartNum, ItemName, Mfg, Mfg Part#
    IF the results from one of those two are empty then i would see something like this
    114, 11, 0, 11, 55002, Pepsi Blue Cap, NULL,
    117, 5, 0, 5, 331501, Marigold Yellow For ABS, NULL
    121,1, 0, 1, 331503, .233 Aluminum Sheet, NULL
    125, 2, 0, 2, 331504, Velvet Vinyl .008, NULL

  • Logical System(ORGLOGSY) populating from which table in R/3 system

    Hi Friends,
    I would like to understand about the Logical System(ORGLOGSY) from which table or from where this logical system being populating.
    Because we could see this fields Logical System(ORGLOGSY) exist in PO item, HDR, SGR data sources.
    Can anybody give some idea, how we'll get this source system logical system name into BW system.
    SIRI

    Hi Siri,
    Check here
    V_TBDLS
    TX: RSA13----->Tools -
    >assigment of source system to source system id
    hope this will help you.  
    Thanks,
    Vijay.

Maybe you are looking for

  • ICloud backs up movies but doesn't sync them?

    May be just a fundamental misunderstanding, but both photos and movies are saved to Camera Roll, and both are included in the iCloud backups (determined by size of backup), so why do the photos sync to the PC but not the movies?  Obviously they are i

  • Upload using LSMW

    hi, I have custom table(ie ztable). It has only only column material. I have a local file containing only material numbers. I want to upload these material into my custom table using Direct Input method. While doing this when i am selecting the first

  • CLASSIC don't works as under 10.3.9!

    I have made a new install of Mac OS 9.2.2 and 10.4.5 on two seperate partitions onto my G4 AGP Graphics("Sawtooth") with 466 MHz and HD 20 GB. After I started Classic it seems to start like every time, but at the end of the starting process nothing h

  • Need to control page view to 20 from an html data source for a spry data repeating region

    </style> <script src="SpryAssetPan/SpryData.js" type="text/javascript"></script> <script src="SpryAssetPan/SpryHTMLDataSet.js" type="text/javascript"></script> <script src="SpryAssetPan/SpryPagedView.js" type="text/javascript"></script> <script type=

  • Error! Result code = -43 ???

    Hi all, I keep getting the following message after opening certain EXS files that have opened with no problems before.. error result code = -43 Can anyone help or point me in the right direction pleeeaaassse Thanks in adv B