Table Join brings in multiple records

Hi guys,
I have created a table join for 2 HR master tables to get a view.
When i output the view however it brings in multiple records for each employee.
I have set PERNR as the Key field to join the tables but instead of giving me one instance of employee it picks it up 2 records....and in some cases many more, is their a fix for this?
Thanks

Hi,
Try using a combined primary key;
PERNR, BEGDA and ENDDA
There are more primary keys to be combined but try with this 3.
~BiSu

Similar Messages

  • One to Many table join -- concat field per record grouped by id

    Post Author: wm5
    CA Forum: Formula
    Hello,
    I am using Crystal Reports XI and have two tables that have a one to many relationship and are joined by an JobID (number).
    Below is a sample with relative fields for each table.
    job_table: JobID (number), Manager (text), Status (text)
    jobaudit_table : JobAuditID (number), JobID (Number), FormID (Number)
    There is a one to many relationship with jobaudit_table having multiple records for each JobID in job_table.
    I have created a Group Header using the job_table.JobID and suppressed the detail section.
    In the group header for each JobID I display the JobID, Manager, Status. I also use the below formula to determine if any records in the jobaudit_table has a record where FormID = 90. If so, I display "Yes". If not, "No".
    So my report currently looks like.
    JobID     Manager     Status     Audit Performed
    1           Manager 1  Closed           N
    2          Manager 2   Closed           Y
    Here are the formula's I use to determine if any records in jobaudit_table contains a record where FormID = 90.
    @ja90exists
    if {jobaudit_table.FormID} = 90 then    1else    0;
    if sum({@ja90exists},{job_table.JobID}) = 0 then    "No"else    "Yes";
    Everything so far works fine. What I would like to do now is add a hyperlink to a script to view the job audit when in the above report the "Audit Performed" column is "Yes"
    So Report is now:
    JobID     Manager     Status     Audit Performed
    1           Manager 1  Closed           N
    2          Manager 2   Closed           Y (hyperlink to view audit)
    I cannot figure out how to gather the valid JobAuditIDs where FormID = 90 grouped by JobID to be used in the Group Heading section of the report.
    Also, it is unlikely, but possible that more than one job_audit record exists with FormID = 90 per JobID. So, my hyperlink could look like http://mysite.com/viewjobaudit.aspx?jobid=[jobaudit_table.JobAuditID],[jobaudit_table.JobAuditID] .
    Thanks for any help. And if this post is not clear let me know and I will clarify.
    wm5

    Post Author: bettername
    CA Forum: Formula
    Although I can't think of a way to get multiple hyperlinks, this should be a start.  It (should) hyperlink to the last job/audit in the group that formID of 90.  Oh, I assumed that the hyperlink should have been  xxxx...jobID,jobAuditID! 
    I think there may be a way of getting hyperlinks to every "90" record, but that will involve a subreport, so lets try this first...
    1 - everything from your group header to the group footer...
    2 -  add a formula into the group header that says:
    whileprintingrecords;
    stringvar jobauditID="";
    stringvar jobID:=";
    3 - Then add a formula to the details section:
    whileprintingrecords;
    stringvar jobauditID;
    stringvar jobID;
    if {jobaudit_table.FormID} = 90
    then (jobID:=totext({job_table.job_id},0,""); jobauditID:=totext({jobaudit_table.jobaudit_id},0,"")
    4 - Finally, on your "Audit Performed" formula, have a conditional hyperlink that says:
    whileprintingrecords;
    stringvar jobauditID;
    stringvar jobID;
    if {@audit performed} = "Y" then http://mysite.com/viewjobaudit.aspx?jobid=jobID","+jobauditID

  • 3 table join finding matching audit records

    hi,
    I have the following 3 tables ( simplified for sake of example)
    TOYS ( rec_no, toy_id)
    CHANGE (rec_no, change_id, status, aff_toy_id)
    A_CHANGE (rec_no, change_id, aff_toy_id, status, operation, log_date, log_time)
    I want to find all the TOYS where a change status was made from PENDING to COMPLETE. The audit table A_CHANGE has an operation field which has 2 possible values. PRE_UPDATE and POST_UPDATE.
    the PRE_UPDATE record would have a status of PENDING and the POST_UPDATE record would have a status of COMPLETED.
    However for any record there could have been many status changes, thus i need to pair the PRE and POST UPDATE records correctly. Currently i have used the following SQL which assumes that the date and time for the PRE and POST would be exactlyl the same.
    create or replace view test as
    select a.aff_toy_id
    from a_change a, a_change b, change c, toys d
    where c.aff_toy_id=d.toy_id
    and c.status='COMPLETE'
    and a.change_id=c.change_id
    and a.change_id=b.change_id
    and a.operation='PRE_UPDATE'
    and b.operation='POST_UPDATE'
    and a.log_date=b.log_date
    and a.log_time=b.log_time
    and a.status='PENDING'
    and b.status='COMPLETE';
    this is not reliable as the PRE and POST may be a minute a part. What i need to do is for any given PRE_UPDATE find the associated POST_UPDATE based on the next sequential rec_no and primary key change_id.
    How do i do this? Maybe i need an external function or procedure? Or is this possible within a single select statement?
    big thanks to anyone who can help me here.
    cheers
    D
    Message was edited by:
    user472959

    I have used lead analytical function. Analytical functions were introduced by oracle in realease 8.1.6. There are over 30 of them. You can get more information about them on the net. Lead function retrieves the value of a column in the next record. Next record is determined by the ORDER BY clause of the function. To group the result by a column or set of columns you use PARTITION BY clause.
    Visit http://asktom.oracle.com/pls/ask/f?p=4950:1:
    Anwar

  • Master data update bringing in multiple records for single entry

    Hello,
    I found that if I deleted and reloaded data in a master data object, it was showing me correct number of records. However, just a full update was not overwriting it with correct number of data records. there were always 1 or 2 extra blank records. I thought master data update should overwrite previous records and we need not delete and reload it.
    Why would this happen?
    Thanks!

    Hi there,
    Are you refering to time dependent master data? From to values are present?
    If so, that's the correct situation, since BW (OLAP) instead of R/3 (OLTP) allows you to mantain historical data, i.e., a material can be valid from a specific time period with several attributes and other attributes can be valid for the same material in another time space.
    Diogo.

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • 3 way table join for a view?

    Hi,
    I need to create a view comprising several complex queries (at least to me...). Below is an example where I have to do a three way table join, based on multiple columns from each table.
    This is the data I need to get at:
    table1."DISTRICT TYPE",
    table1. "DISTRICT CODE",
    table1."EO_NAME"
    With the following constraints:
    table1 joined with table2 via DISTRICT_TYPE and DISTRICT CODE
    table2 joined with table3 via PRECINCT and PRECSUB
    What is the best query to use in this situation? Or, is there a better alternative, considering I do have to create a view?
    Thanks very much.

    This one really is a basic join question, and a quick perusal of the SQL Reference Manual, or any basic SQL book would provide an answer. However ...
    Assuming your tables look like:
    TABLE1
    district_type
    district_code
    eo_name
    TABLE2
    district_type
    district_code
    precinct
    precsub
    TABLE3
    precinct
    precsub
    other_stuff
    then
    SELECT a.district_type, a.district_code, a.eo_name,
           b.precinct, b.precsub,
           c.other_stuff
    FROM table1 a, table2 b, table3 c
    WHERE a.district_type = b.district_type and
          a.district_code = b.district_code and
          b.precinct = c.precinct and
          b.precsub = c.precsub

  • Selecting single record from multiple record based on date

    Hi experts,
    I have a table which contains the multiple records for single ID No. Now i have to select single record which contains the latest date.
    here is the structure
    Name   Null Type        
    ID_P        NUMBER      
    NAME_P      VARCHAR2(12)
    DATE_P      TIMESTAMP(6)
    Records
    1 loosi     22-AUG-13 01.27.48.000000000 PM
    1 nammi  26-AUG-13 01.28.10.000000000 PM
    2 kk        22-AUG-13 01.28.26.000000000 PM
    2 thej      26-AUG-13 01.28.42.000000000 PM
    now i have to select below 2 rows how can write select qurie for this?
    1 loosi     26-AUG-13 01.27.48.000000000 PM
    2 thej      26-AUG-13 01.28.42.000000000 PM

    Hi,
    You can use the analytic ROW_NUMBER function.
    I don't have a copy of your table, so I'll use scott.emp to illustrate.  In scott.emp, there may be multiple rows for a single job.  To display just 1 row per job, the row with the most recent hiredate:
    WITH got_r_num AS
         SELECT  empno, job, deptno, hiredate -- Or whatever columns you want
         ,       ROW_NUMBER () OVER ( PARTITION BY  job
                                      ORDER BY      hiredate DESC
                                    )  AS r_num
        FROM    scott.emp
    --  WHERE ...   -- If you need any filtering put it here
    SELECT   *      -- Or list all columns except r_num
    FROM     got_r_num
    WHERE    r_num   = 1
    What results do you want in case of ties?  Depending on your requirements, you may want to add tie-breaking expressions to the analytic ORDER BY clause, and/or use RANK instead of ROW_NUMBER.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Point out where the query above is producing the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
    If you modify the query at all, post your modified version.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Multiple tables with the possibility of multiple records in each table

    Post Author: viper
    CA Forum: .NET
    Hi
    I have been trying for a few days now to come up with a CR solution to displaying data from multiple tables.  These tables, in some cases, have more then one record that needs to be displayed.  This is basically what I am trying to do.....
    I am developing a .net web application(vb) using vs2005 and an oracle 10g backend.  There is a data entry part of the site that users will enter data related to a property.  Other users will be able to search these records and have a list of records returned based on the search criteria.  The user then can click on one of these records to view a pop up CR report containing all the data related to that one property.  The PropID is passed to the pop up page and is used in the WHERE clause of my SQL statement to bring back only one property.  This data can come from as many as 18 tables if all the fields have been entered for this property.  I have tried many different solutions to get the data from multiple tables...and have had some that were close to what I need.  The best one I have will display data from multiple tables but only one record per table.....which doesn't work in my case since some of the tables have more then one record per table.
    Is there anybody that has had success in setting up similar reports?
    Does anybody know how I could use the "Group Expert" to group by the tables in my application?  I can only figure out how to group within a single table.
    It would be great if I could group by table....then just display the record(s) in each table that had the same PropID.  I am not sure if the pdf export would show all the data in that situation but it would be worth a try.  If fact...maybe I could create a new table called MyTables and just add two colums like MyTableID and MyTableName.  Then add all the table names to MyTables that I want to see in the report and add the associated MyTableID value to each table as a new column.  I could then group by MyTableID and PropID.  Just guessing here.
    Any ideas would be appreciated.

    Post Author: quafto
    CA Forum: .NET
    Your query is not too clear so I'll do my best to answer it broadly.
    You mentioned that you have a .NET web application where your users enter data on one screen and then may retrieve it on another. If the data is written in real time to a database then you can create a standard Crystal Report by adding multiple tables. The tables should be linked together using the primary and foreign keys in order to optimize the database query and give you a speedy report. Using unlinked tables is not recommended and requires the report engine to index the tables (it is quite slow).
    You also mentioned you have a "PropID" to be used in a WHERE clause. This is a great place to use a parameter in your report. This parameter can then be used in your record selection formula inside Crystal Reports. The report engine will actually create the WHERE clause for you based on the parameter value. This is helpful because it allows you to simply concentrate on your code rather than keeping track of SQL queries.
    Now, what Crystal does not do well with is uncertainty. When you design a report with X number of tables the report engine expects X number of tables to be available at processing time. You should not surprise the print engine with more or less tables because you could end up with processing errors or incorrect data. You may need to design multiple reports for specific circumstances.
    Regarding the group expert question. I'm not sure how you would/could use the group expert to group a table? A table is a collection of fields and cannot be compared to another table without a complex algorithm. The group expert is used to group and sort records based on a field in the report. Have a look at the group expert section of the help file for more information.
    Hopefully my comments have given you a few ideas.

  • How to create Form based on a table to display multiple record

    Hello All,
    Would somebody please tell me how to create a Form based on a single table ,
    to view and insert multi record based on a single table.In other words I would like
    to have a form as shown below ,where the users can Insert,update,delete,query and so on
    Item Id PArt Number List Price
    100 Item-1 $120.oo
    200 Item-2 $150.00
    300 Item-3 $50.00
    I know I can do it as Single Record block using Tabular Format,but multiple record ?????
    Thanks in Anticipation
    Babu

    Try this method,
    1. Creat a Master Detail Form (Custom Layout and not tabular)
    and in the master block select one field.
    2. In the HTML layout for master remove the reference for
    that field(so that nothing will appear in the master block
    of the form).
    3. Before the update (in the Pl/SQL event handler select the 'Save' event and write the following code to avoid updating master block).
    p_session.set_value(p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'MASTER_ACTION',
    p_value => 'None');
    doSave;
    For eg, let's say
    Master is from 'Dept' table and Detail is from 'Emp' table(with join condition Dept.dept_id = Emp.dept_id). In the master remove everything except dept_id field and in the HTML layout for master remove the reference of the dept_id field(you cannot remove this field physically from the master layout). Now the form will look like multirow form rather than master detail form but only problem with this workaround is 'Detail Action' will be present in the detail block.
    I hope this will help you.
    Thanks
    -Krishnamurthy

  • Inserting multiple records into a database from a table

    I have a dynamic table with rows upto 10. i am trying to insert all the records in these rows into a database ( msaccess)
    table name: Table1 ( in my form )
    Database table : movies_comments ( as posted in stefan's forums ).
    table columns: username, movieid, comments
    i am using the following code.
    Database.ExecSQL() function is as posted in stefcamerons forums.
    var tlength = xfa.resolveNode("form1.#subform[0].Table1.Row1[*]").length;
    xfa.host.messageBox("tlength is :" +tlength);
    for ( var i = 1; i <= tlength; i++)
    var username = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].user_name").rawValue;
    var movieID = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].movie_id").rawValue;
    var commentS = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].comment_").rawValue;
    Database.ExecSQL("INSERT INTO movie_comments (username, movieId, comment) VALUES ('username','movieID', 'commentS');");
    i am trying to insert multiple records using the code above. But i am getting error
    GeneralError: Operation failed.
    XFAObject.resolveNode:1:XFA:form1[0]:#subform[0]:Button1[0]:click
    SOM expression returned list when single result was expected
    suggest me an alternate way to insert multiple records from a table into a database.
    thank Q

    figured it out. I changed the ...OR (alternative names = colname) in the recordset to ...OR (alternative names LIKE %colname%). Works like a charm now- the result of a good night's sleep.

  • Insert multiple records into a table(Oracle 9i) from a single PHP statement

    How can I insert multiple records into a table(Oracle 9i) from a single PHP statement?
    From what all I've found, the statement below would work if I were using MySQL:
         insert into scen
         (indx,share,expire,pitch,curve,surface,call)
         values
         (81202, 28, 171, .27, 0, 0, 'C' ),
         (81204, 28, 501, .25, 0, 0, 'C' ),
         (81203, 17, 35, .222, 0, 0, 'C' ),
         (81202, 28, 171, .27, 2, 0, 'C' ),
         (81204, 28, 501, .20, 0, 1, 'C' ),
         (81203, 28, 135, .22, 1, 0, 'C' )
    The amount of records varies into the multiple-dozens. My aim is to utilize the power of Oracle while avoiding the i/o of dozens of single-record inserts.
    Thank you,
    Will

    You could look at the INSERT ALL statement found in the documentation here:
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_913a.htm#2133161
    My personal opinion is that you probably won't see any benefit because under the hood I think Oracle will still be doing single row inserts. I could be wrong though.
    The only way to confirm was if you did a test of multiple inserts vs an INSERT ALL, that is if the INSERT ALL met your requirements.
    HTH.

  • Loading Hex Files with multiple records with each line starting with : record marker, how do I load this hex file into a front panel table ? thanks in advance, Jeff.

    I have written a routine that loads a Hex file, checks for record marker,length,address etc then loads the data into a table on front panel. However, my routine only loads single record hex files. I need to be able to load multiple record files, I need to identify the ':' colon record marker start for each record in the hex file, I just can't see how to loop my routine so that all records with ':' prefix marker are loaded.

    Jeff,
    I'm not exactly sure of what you are trying to do. Is it possible you could post your code, or a screen shot of the diagram in question, so that I can get a better understanding, and possibly offer some assistance?
    I am familiar with hex files, but not with the : marker separating records. This may be able to be solved with simple text parsing, and as I am not familiar with how you are retrieving and/or displaying the files, I require more information.
    Thanks

  • How to select multiple records from a TREE in the table

    HI,
    I have a tree structure which is in the table.When I open the node of the tree,all the subnodes are coming as one-one records in the table.I want to slect multiple record from this table.I applied onLeadSelect for this table,I can select only 1 record from the table.
    Can any one plz suggest me how to select multiple records from the table so that I can get all the data of those selected record.
    Regards
    -Sandip

    Rashmi/Kukku,
    First of all, Thanks for your help!
    Is there any other way in which we can access tables other than using BAPIs or RFCs?
    In my case, there is a table structure which has to be updated with values after validating a key. i don't think there is any RFC available now. do i need to create bapi/rfc for that?
    Krishna Murthy

  • Multiple record update in TABLE Control.

    Hi All,
    I m developing dialog program with table control.
    I want to know how to update multiple records through the table control if user selects more than one.
    Also depending on some condition i want to change the status of one reocrd and not the column as a display field and won't be editable. I have tried with loop at screen and modify screen, but it is showing the whole column as display only.
    ANy solution let me know

    Hi,
    pls chk this standard pgms.
    for examples on table control
    demo_dynpro_tabcont_loop
    demo_dynpro_tabcont_loop_at
    RSDEMO_TABLE_CONTROL
    chk a sample code.
    DATA :BEGIN OF int_table OCCURS 0,
           fld1 TYPE ztable-fld1,
            fld2 TYPE ztable-fld2,
            fld3 TYPE ztable-fld3,
            chk(1),
          END OF int_factor.
    *write the blow code in PAI
    LOOP AT int_table WHERE chk = 'X'.
    *modify the data base table
    MODIFY ztable FROM  int_table. "from header
    clear int_table
    ENDLOOP.
    regards
    Anver

  • Context index can't be used in complicated multiple tables join?

    hello
    thank you for view this page.
    i have a comlicated sql :
    SELECT count(*)
    from
    ((app_AssetBasicInfo left join app_AssetBasicInfoExt on
    app_AssetBasicInfo.id=app_AssetBasicInfoExt.id) left join
    (app_AssetCustominfo1 left join app_AssetCustominfoExt1 on
    app_AssetCustominfo1.id=app_AssetCustominfoExt1.id) on
    app_AssetBasicInfo.id=app_AssetCustominfo1.id) WHERE
    app_AssetBasicInfo.CategoryID=1 AND Del_tag=0 and contains(description,'department')>0;
    the table app_AssetBasicInfo and app_AssetBasicInfoExt have multiple columns and large recoord size. i create a context index on app_assetbasicinfoext(description) which description is 4000 varchar2.
    but the sql doesn't use context index. i suspect that the complicated multiple table join can't use context index? does it correct?
    thanks very much!

    Could you please post an explain plan? I'm not quite sure what is the issue.

Maybe you are looking for

  • How do I clone a fully operational system that relies on Windows 7 for the underlying operating system?

    I'm a retired IT professional desiring to assist a friend who owns a small business who recently experienced very malicious attacks on her computers from unknown parties operating anonymously on the Internet. Because of her lack of preparation for su

  • Custom DB password in WCS 7.0.220.0

    Hi there, we are desperately trying to set a custom password of our WCS database in order to use it for direct SQL queries (Cumbersome over Web surface). To my knowledge there is a way to reset it however this password would be randomly generated and

  • Cant accept incoming calls

    Just bought an iphone 3g from a friend and I am currently on a pay as you go contract. Anyone who tries to contact me gets an engaged tone, I have altered the sim card threetimes with O2 to no avail. Please can anyone advise or help Awaiting in antic

  • Help before I throw this printer out of the window!!!!!!!!!!!!!!!!!

    I have just purchased a Deskjet 2540 all in one printer - I will only ever need to print boarding passes etc. - this looked so good on Amazon ideal for my iPad and said how easy to set up!!! In my dreams - I have now spent 10 hours Trying to set this

  • Ifolder not syncronising on 1 pc

    I folder is not loging into Server on 1 PC The same username and password works on another PC!! I have removed and re-installed ifolder Any ideas how to fix this? client version 3.8.4.1