Crystal Reports - Two Tables in one report, grouped by machine.

I have two tables for machine schedules.  One is a Current Job Table, and the other is a Que Job Table.  I do have tables joined to a definition table for the machine name.
Cur Job Table - Def table
Que Job Table - Def table
I want to report the information from the current job table for each 13 machines in sequence.  Some machines may have more current jobs than qued jobs.
...Machine 1 (Machine Name)
.....Current Jobs (Cur Job Table)
.....Qued Jobs (Que Job Table)
...Machine 2 (Machine Name)
.....Current Jobs (Cur Job Table)
.....Qued Jobs (Que Job Table)
Etc.
Is there a way to do this easily?  I have tried grouping and sub reports.  Seems like I end up with duplicate records due to the SQL joins.

Sharon,
Select distinct will not work here, as select distinct checks all fields in the record, and when joining the two detail tables, it will not clear out "duplicates" on only one side of the join.
I would also humbly suggest that using Select Distinct to try to "clean up" a query is rather dangerous.  You may end up dropping some data that should appear on the report.  (In fact I recently had to fix a report due to this issue - coded by someone else, of course!  :->)  If you are getting duplicate records and you don't want them, the query should be coded to produce the desired result set WITHOUT the Distinct clause being the reason duplicates are dropped.  (This is not to say that select distinct is not useful, or should never be used.  If you need a distinct list of customers over a date range, using Select Distinct custcode from sales where date between {?start} and {?end} is perfectly OK.)
HTH,
Carl

Similar Messages

  • Combining two tables into one result

    Hi all, I am fairly inexperienced with Crystal but have gained good results from the reports I have created, I am fluent in SQL and Basic to an extent.  I am interigating a Pronto database and I want concatenate two tables into one report.
    Table One: Customer Orders
    Fields:  Customer No, Invoice Number, Invoice date, Invoice Amount, Cost Amount.
    Table Two: Archived Customer Orders
    Fields:  Customer No, Invoice Number, Invoice date, Invoice Amount, Cost Amount.
    I want to complete a report that will tell me the sales for a given period and the outstanding orders for each customer total for all fields in each table combined into one figure.
    Any help would be greatly appreciated.
    Thanks in advance

    Hi Grant,
    As you said you are goot at writing SQL, in Crystal write a SQL statement in Add Command to join both table using Union / Union all
    If you use Union then it will filter duplicate records and pull the data from database, If you use Union All then it will include all your duplicate records.  Please use Union / Union All as required.
    Once you get all data into the report create a parameter for date range and generate the summaries as required.
    Thanks,
    Sastry

  • JOIN TABLES IN ONE REPORT

    Hi,
    I'm trying to join some tables in one report. I was successful with it, until I added one table which has many records for one primary key in the main table. I used Order by and Limit to select only the latest row, but then I got this error: Query cannot be parsed, please check the syntax of your query. (ORA-00907: missing right parenthesis)
    The sql is here:
    select
    t.TICKET_ID "Ticket Id",
    t.RECEIVED_DATE "Received Date",
    t.QUOTE_NUMBER "Quote Number",
    r.REQUEST_NAME "Request Type",
    s.STATUS_NAME "Status",
    p.PRIORITY_NAME "Priority",
    t.NUMBER_OF_SUBLINES "Number Of Sublines",
    t.QUOTE_VALUE "Quote Value",
    c.CURRENCY_NAME "Currency",
    t.QUOTE_START_DATE "Quote Start Date",
    t.CUSTOMER_NAME "Customer Name",
    t.REQUESTER_EMAIL "Requester",
    st.STRIPE_NAME "Stripe",
    tm.TEAM_NAME "Team",
    a.ANALYST_NAME "Quote Analyst",
    (select g.GATE_COMM from QTMT_GATE_COMM g where g.TICKET_ID=t.TICKET_ID order by g.GATE_COMM_ID desc limit 1)GATE_COMM,
    ac.ANALYST_COMM "Quote Analyst Comment",
    cc.CLOSE_COMM "Closing Comment",
    se.SERVICE_NAME "Type Of Service",
    ro.REOPEN_NAME "Reopen",
    t.ASSIGNED_DATE "Assigned Date",
    t.LAST_UPDATED "Last Updated",
    t.DATE_COMPLETED "Date Completed",
    t.EFFORT "Effort"
    from
    QTMT_TICKETS t,
    QTMT_REQUEST_TYPE r,
    QTMT_STATUS s,
    QTMT_PRIORITY p,
    QTMT_CURRENCY c,
    QTMT_STRIPE st,
    QTMT_TEAM tm,
    QTMT_ANALYST a,
    QTMT_ANALYST_COMM ac,
    QTMT_CLOSE_COMM cc,
    QTMT_SERVICE se,
    QTMT_REOPEN ro
    where
    t.REQUEST_TYPE_ID=r.REQUEST_TYPE_ID and
    t.STATUS_ID=s.STATUS_ID and
    t.PRIORITY_ID=p.PRIORITY_ID and
    t.CURRENCY_ID=c.CURRENCY_ID and
    t.STRIPE_ID=st.STRIPE_ID and
    t.TEAM_ID=tm.TEAM_ID and
    t.ANALYST_ID=a.ANALYST_ID and
    t.ANALYST_COMM_ID=ac.ANALYST_COMM_ID and
    t.CLOSE_COMM_ID=cc.CLOSE_COMM_ID and
    t.SERVICE_ID=se.SERVICE_ID and
    t.REOPEN_ID=ro.REOPEN_ID
    Could you please let me know what do I have wrong?
    Thank you and best regards,
    Vladimir

    It's a problem with me not being able to run the code to test it. Basically the problem is that the subquery is nested too deeply to be able to see the QTMT_TICKETS table. It is not 'missing' as ApexBine suggests but it is unavailable. The most deeply nested subqueries execute first, and that one is executing before the QTMT_TICKETS table is available to it. Off the top of my head, the easiest thing then would be to create a function to get the GATE_COMM value (I'm guessing at the data types):
    FUNCTION gate_comm (p_ticket   NUMBER)
    RETURN VARCHAR2
    AS
      CURSOR c_gc IS
        SELECT g.GATE_COMM
        FROM   QTMT_GATE_COMM g
        WHERE  g.TICKET_ID = p_ticket
        ORDER BY g.GATE_COMM_ID DESC;
    BEGIN
      FOR v_Lp IN c_gc LOOP
        RETURN v_Lp.gate_comm;
      END LOOP;
    END;Then you can replace the failing subquery in the SQL with gate_comm(t.TICKET_ID)

  • I need two query in one report (two detail section in one query)

    Hi master sorry for again distribute
    Sir I need two query in one report
    Because I need two detail section in my one report
    Such as
    Master
    Vno=9088989
    Detail          1
    =
    =
    ==
    =
    Total                     99999
    Detail          2
    =
    =
    ==
    =
    Total                     33333
    Sir how I get this type of report
    Please give me idea
    Thanking you
    Aamir

    I want to see the report as follow.
    d_name: CPU-1
    date: -----------
    Software installed:
    sw_id, software, version, serial_no, sw_type
    (list of softwares attached, can be more then one)
    Hardware attached:
    hw_id, hardware, specification (same like software list, it will contain hardware list attached to specific device),
    Please if you can help me that how will i make a query for this.
    Thanks and Regards
    Maz

  • Join two tables to one recordset with nested table?

    Hello all!
    I want to "de-normalize" two tables into one for presentation reasons. For example:
    CREATE TABLE foo(id number)
    CREATE TABLE bar(foo_id number, value varchar2(4))
    And with some data:
    FOO:
    1
    2
    BAR:
    1, 'gaz'
    1, 'boz'
    2, 'blah'
    Now I want to create a view that holds the value of the BAR table in a nested table, if possible and efficient enough..
    VIEW:
    1, nested_table('gaz,'boz')
    2, nested_table('blah')
    Any clue for creating such a view? I would prefer a view, because this view will be joined with other tables later.
    Thanks in advice!

    Or
    SQL> with foo as
      2  ( select 1 id from dual union all
      3    select 2 id from dual
      4  ),
      5  bar as
      6  (
      7    select 1 foo_id, 'gaz'  value from dual union all
      8    select 1 foo_id, 'boz'  value from dual union all
      9    select 2 foo_id, 'blah' value from dual
    10  )
    11  --
    12  --
    13  select id,
    14         cast(multiset((select value from bar where id=foo_id)) as sys.dbms_debug_vc2coll) value
    15    from foo
    16  /
            ID VALUE
             1 DBMS_DEBUG_VC2COLL('gaz', 'boz')
             2 DBMS_DEBUG_VC2COLL('blah')or from 10g on
    SQL> with foo as
      2  ( select 1 id from dual union all
      3    select 2 id from dual
      4  ),
      5  bar as
      6  (
      7    select 1 foo_id, 'gaz'  value from dual union all
      8    select 1 foo_id, 'boz'  value from dual union all
      9    select 2 foo_id, 'blah' value from dual
    10  )
    11  --
    12  --
    13  select id,
    14         cast(collect(value) as sys.dbms_debug_vc2coll) value
    15    from foo, bar
    16    where id=foo_id
    17    group by id
    18  /
            ID VALUE
             1 DBMS_DEBUG_VC2COLL('gaz', 'boz')
             2 DBMS_DEBUG_VC2COLL('blah')Edited by: michaels2 on Oct 8, 2008 2:27 PM

  • How to transfer the tables from one file group to another file group in SQL 2008.?

    Hello all,
    I have few issues regarding the transfer of the tables from one file group to another file group  in SQL 2008 and also How can we  backup
    and restore the particular database based on file group level.
    Let’s say I have a tables stored within the different FG. such as
    Tables                                                    
      File group
    Dimension tables                                              
                                                                     Primary
    Fact tables                                               
                                                                              FG1
               FG2…
    zzz_tables                                               
                                                                              DEFAULT_FG    
    dim.table1                                                                                                                          DEFAULT_FG
    dim.table2                                                                                                                          DEFAULT_FG
    Here all I want to transfer the dim.table1 ,dim.table2  from  DEFAULT_FG to the Primary File
    group .So is there simple methods for transfer the dim.table1,2  from one FG to another .I have tried somewhat but I couldn’t get the exact way .So if someone have better idea please share your knowledge that would be really appreciated.
    Secondly after moving those dim.table1 ,dim.table2 from DEFAULT_FG to Primary ,All I want to backup and restore the database only containing  the Primary and FG1,FG2… not
    a DEFAULT_FG.Is it possible or not.?
    Hope to hear from the one who knows better approach for this kind of task .Your simple help will be much appreciated.
    Regards,
    Anil Maharjan

    Well after all my full day research on this topic had paid off, I finally got the solution and am so happy to research on these things. It makes
    us feel really happy after all our research and hard work doesn't goes as waste.
    Finally I got what I am looking for and want to make sure that I am able to transfer the tables from DEFAULT_FG to another FG without tables
    having clustered index on that tables .
    With the help of the link below I finally got my solution where Roberto’s coded store procedure simply works for this.
    Really thanks to him for his great post and thanks to all for your response and your valuable time.
    http://gallery.technet.microsoft.com/scriptcenter/c1da9334-2885-468c-a374-775da60f256f
    Regards,
    Anil Maharjan

  • Spliting a table in to two table based on the groups in SSRS

    Hi,
    I am trying to a split a rows accross two tables based on a group.
    So far I have added a list and added a row group and grouped it using lineof business
    Inside my list i have two identical tables so i can display the data
    for the first table i have set the row visibility as follows: where LineOfbusiness1 is the  groupname of my list group
    =RowNumber(Nothing) >= (IIf(CountRows("LineOfBusiness1")\2 = 1, CountRows("LineOfBusiness1")/2, (CountRows("LineOfBusiness1")/2)+1))
    and for the second table in the i have set the row visibility as follows
    =RowNumber(Nothing)< (IIf(CountRows("LineOfBusiness1")\2 = 1,CountRows("LineOfBusiness1")/2, (CountRows("LineOfBusiness1")/2)+1))
    this set up works fine for the first group but it doesnt display the data the way i want for the subsequent groups.
    so how do i have the table start over after each group... plus in my group i have specified to do a page break after everygroup...
    Any help will be appreciated.
    Thanks
    Karen

    Visakh,
    Thanks for answering.... a sample for the data will look like
    dataset----
    create table #dataset
    Code varchar(5),
    Name varchar(200),
    Lineofbusiness int,
    Statename varchar(10),
    typed int,
    description varchar(2000)
    insert into #dataset
    select 45111,abc,1,AL,4500,policies
    insert into #dataset
    select 45111,abc,1,AL,2500,vehiles
    insert into #dataset
    select 45111,abc,1,AL,3,drivers
    insert into #dataset
    select 45000,bca,2,AL,4500,policies
    insert into #dataset
    select 45000,bca,2,AL,500,house
    insert into #dataset
    select 45000,bca,2,AL,40,theft
    When i display the data i want it to be
    Line of business 1
    policies 4500 drviers 3
    vehiles 2500
    Line of business 2
    Policies 4500 theft 40
    House 500
    but right now the for lineofbusiness 1 its showing the correct way for but the line 2 everything is being displayed in the right.
    Thanks
    Karen

  • How to separate report layout sections in one report

    All,
    I'm trying to determine how to separate report layout sections in one report using Report Builder 10g. My requirement is to provide a user the ability to display a report in PDF, excel, RTF formats. How can I assign LayoutA to 'PDF' and 'RTF', LayoutB to 'Spreadsheet'?
    I've attempted to utilize the Header and Main sections in the paper layout, which contain unique layouts of the same report, but during generation, both sections are being displayed.
    Thanks
    Edited by: Jdavis on Apr 10, 2009 10:56 PM

    Hi there,
    How are you running the report? If you are selecting different types of output before calling the report then you could pass a parameter that is checked at runtime in the report and suppresses the layouts you do not want using format triggers.
    Mark

  • Saving data into two tables "in one transaction"

    Hello everybody!
    My scenario is the following: SAP PI receives message containing some data (header and MULTIPLE details data in one message) and has to transfere this data to a database.
    In the database there are two tables for storing the data contained in the message: one for HEADER data and one for DETAILS data. I need to save all the data (header and MULTIPLE details data) into these two tables "in one transaction" and roll back saving of HEADER data and DETAILS data if saving of some DETAILS data has failed.
    I am going to use receiver JDBC adapter for this purpose.
    My questions are:
    1. How can I save all the data "in one transaction"? Will it work if I transform the source message into the target message which looks something like this?
    <root>
      <StatementName1>
        <dbTableName action=u201CUPDATE_INSERTu201D>
        <table>HEADER_table</table>
        <access>
        <col1>val1</col1>
        <col2>val2</col2>
        </access>
        <key1>
        <col1>val1</col1>
        </key1>
        </dbTableName>
      </StatementName1>
      <StatementName2>
        <dbTableName action=u201CUPDATE_INSERTu201D>
        <table>DETAILS_table</table>
        <access>
        <col1>val1</col1>
        <col2>val3</col2>
        </access>
        <key1>
        <col1>val1</col1>
        </key1>
        </dbTableName>
      </StatementName2>
      <StatementName3>
        <dbTableName action=u201CUPDATE_INSERTu201D>
        <table>DETAILS_table</table>
        <access>
        <col1>val1</col1>
        <col2>val4</col2>
        </access>
        <key1>
        <col1>val1</col1>
        </key1>
        </dbTableName>
      </StatementName3>
    </root>
    2. How to roll back saving of HEADER data in the case of saving of DETAILS data has failed?
    3. What will be the response structure returned by database look like in the case of success?
    Thanks,
    Vika

    I guess the response in my case will be something as following?
    <response>
    <Statement1_response>
    <row>
    <update_count>1</update_count>
    <insert_count>0</insert_count>
    </row>
    </Statement1_response>
    <Statement2_response>
    <row>
    <update_count>0</update_count>
    <insert_count>1</insert_count>
    </row>
    <row>
    <update_count>0</update_count>
    <insert_count>1</insert_count>
    </row>
    </Statement2_response>
    </response>
    Vika

  • If I have an EntityBean that mappes to two tables within one database, when I create that EJB, whoes reponsibilty to generate the primary key in database table? The RDBMS or EJB?

    If I have an EntityBean that mappes to two tables within one database, when I create
    that EJB, whoes reponsibilty to generate the primary key in database table? The
    RDBMS or EJB?
    Thanks,
    JW

    Refer to http://e-docs.bea.com/wls/docs81/faq/ejb.html/#257430
    "Jingwei Zhang" <[email protected]> wrote:
    >
    If I have an EntityBean that mappes to two tables within one database,
    when I create
    that EJB, whoes reponsibilty to generate the primary key in database
    table? The
    RDBMS or EJB?
    Thanks,
    JW

  • Collapsing two tables into one table or one queue

    When you have data that exists in 2 tables A and B and B is essentially a child of A if you want to process these records such that you see all A's before their assoociated B how can you use either Streams or AQ to collapse these two tables into one? The data exists at it's source in database tables it will be replicated to another location and at that location I want to keep the data as it exists at the source but also process it in the ordered fashion I described above. My thinking is to publish the data to one queue but the challenge is to ensure that all A's are put on the queue before their B is. I don't just want a priority queue whereby all A's are processed before B's because if that happens B's will never be processed. but I simply want to avoid reading a B off the queue before I've read it's A.

    No version number and no clarity of what you are trying to accomplish.
    Without knowing that the problem is a nail ... I'd hardly be recommending using a hammer.

  • Can you really update two tables in one SQL statement

    Ok a post in the forum has got me awefully curious:
    Can you update two tables in one update statement i.e something like this
    update table a , b
    set b.<column> = something
    a.<column> = something
    Something to this effect.
    If you are curious to know what post I am talking about it is called "updating a single row"

    No. You can only update one table in one SQL statement.

  • Delete from two tables in one statement

    Hi,
    Is there a way to delete from two tables in one statement?
    Actually I have two tables:
    1. Base table (id, name, age)
    2. Person table (id, city, street)
    The id in both tables is identical.
    I would like to delete using something like a join:
    Delete from base, person where id=2;
    Thanks
    dyahav

    Hi,
    If you want to delete records both at a time them your table must use ON DELETE CASCADE. See the below example.
    CREATE TABLE supplier
    ( supplier_id numeric(10) not null,
    supplier_name varchar2(50) not null,
    contact_name varchar2(50),
    CONSTRAINT supplier_pk PRIMARY KEY (supplier_id)
    CREATE TABLE products
    ( product_id numeric(10) not null,
    supplier_id numeric(10) not null,
    CONSTRAINT fk_supplier
    FOREIGN KEY (supplier_id)
    REFERENCES supplier(supplier_id)
    ON DELETE CASCADE
    In this example, we've created a primary key on the supplier table called supplier_pk. It consists of only one field - the supplier_id field. Then we've created a foreign key called fk_supplier on the products table that references the supplier table based on the supplier_id field.
    Because of the cascade delete, when a record in the supplier table is deleted, all records in the products table will also be deleted that have the same supplier_id value.
    Thank you.

  • Two pivot tables in one report - obiee 11.1.1.5

    Hi experts!
    Is possible to do a two pivot table (EACH with DIFFERENT CALCULATED ITEMS)??
    For example:
    Pivot table:
    Calc1
    Calc2
    Calc3
    (Hide all other members dimension, only show 3 Calc items)
    Pivot table2:
    Calc5
    Calc6
    Calc7
    (Hide all other members dimension, only show 3 Calc items)
    Now...If I change one calc, it changes for all pivot tables in my report... :(
    Thanks!!!
    Edited by: Alex1 on 22-sep-2011 9:44

    Hi!
    I can't create my calcs in column criteria.
    When I create calc items in first pivot table and create a second pivot table, I have this calcs...and I want another calcs in second pivot table...

  • Grouping two sections in one report

    Hello,
    I am newbie to Crystal Reports.I have one doubt in designing a report.
    The proto for the report is:
    Date: XX:XX:XXXX
                                    Sales Report - Value
    S No     Item         Increase    Decrease
    1           XXX
    2           YYY
                                    Sales Report - Volume
    S No     Item         Increase    Decrease
    1           XXX
    2           YYY
    Here, there is a hyperlink in Item in both Value Report and Volume Report, which opens a subreport about the item.
    How can i proceed the proto. It is easy to group an item if it is only Sales - Value Report.
    Here, both Value and Volume report should present in main report.How can i proceed with Sales Report - Value and Sales Report - Volume in a single report file, without subreport concept.
    If i use the subreport here, i am not able to include a subreport- hyperlink in Item.
    Thanks in advance.
    With Regards,
    Suresh M.

    In the main report insert a group on Value and in group footer place a subreport that consist of data under Volume group. Pass the Volume field value from main report to subreport using change subreport links by right clicking the subreport.
    Regards,
    Raghavendra

Maybe you are looking for

  • How can I open multiple files as Photoshop Raw files at the same time for Photoshop CS6 extended on a PC?

    I am trying to open 20-25 files at the same time as Photoshop Raw [*.RAW] files. The only way I can open multiple files is if i leave the file type as All Formats. When I change it to  Photoshop Raw [*.RAW], the files a deselected.

  • Error 3003 in widget browser?

    hi em every time i try and import a widget into the widget browser i just get error [3003] File or directory does not exist? anyone know why this is or how i could fix it? i'm able to use widgets from the adobe exchange fine, just nothing else :/ was

  • IPhoto sharing only works 1 way ?!?

    Hi, I've got a MacMini and a MacBook Pro both running the latest and greatest version of Leopard (10.5.6) and iLife '09. Now I want to share the iPhoto library from the MacMini to the MBP and that does not work, the library does not show up in iPhoto

  • Can ipad be reprogrammed to use verizon 3g, can ipad be reprogrammed to use verizon 3g

    I purchased my iPad from Apple about a year ago with 3G (AT&T).  I live in an area that does not have AT&T cell service but does have Verizon.  Can I get my iPad software updated so I can use Verizon 3g?

  • ITunes running set up multiple times

    Hi, Does anyone know why iTunes would run through set up without a downloaded update? My iTunes runs though the set up process many, many times. Since I've been keeping track of the set ups, it has run 11 times with only one of those times being with