Avoid Joining Table Multiple Times

I have two tables EMPLOYEE and EMPLOYEE_HOURS.
EMPLOYEE contains EMPLOYEE_ID
EMPLOYEE_HOURS contains EMPLOYEE_ID, HOURS, TYPE
So the EMPLOYEE_HOURS table will contain multiple entries for a given period with hours for types 1, 2 and 3.
I need to display all this on a single line. My query today is
select e.employee_id, eh1.hours, eh2.hours, eh3,hours
from employee e
inner join employee_hours eh1 on e.employee_id = eh1.employee_id and eh1.type = 1
inner join employee_hours eh1 on e.employee_id = eh1.employee_id and eh1.type = 2
inner join employee_hours eh1 on e.employee_id = eh1.employee_id and eh1.type = 3This only works if I know the number of types and their codes. I know I could create a procedure and build the query dynamically, but I’m wondering if there’s some other SQL and/or PL/SQL that can handle this in a single query?
Thanks,
Mark

If you don't know the number of codes in advance, then you don't know the number of columns in the result set in advance. Since a single SQL statement cannot return different numbers of columns on different executions, that almost always means that you need to use dynamic SQL to generate the SQL statement at runtime. It is possible, as well, to write a generic pipelined table function that returns a different number of rows but that is generally vastly more complicated (there have been examples posted here in the forums if you really want to go down that path).
If you know the number of codes (or you can return a fixed number of columns that is known in advance), you don't need to know the individual code values
SELECT employee_id,
       MAX( CASE WHEN rnk = 1 THEN hours ELSE null END) hours_1,
       MAX( CASE WHEN rnk = 2 THEN hours ELSE null END) hours_2,
       MAX( CASE WHEN rnk = 3 THEN hours ELSE null END) hours_3
  FROM (SELECT employee_id, hours, rank() over (partition by employee_id order by type_id) rnk
         FROM employee)
GROUP BY employee_idJustin

Similar Messages

  • Optimizing the Query  joining two tables multiple times

    Hi all,
    I need to formulate a query where I want to get data from two tables.Here are the table structures and sample data.
    Table1
    id firstname lastname accountnumber
    1 Sridh Peter SP456
    2 Gane San SS667
    3 Sway patel PP345
    Table 2
    id attributename attributevalue
    1 Manager Mike
    1 Lawyer Schwa
    1 Server maneka
    1 location langur
    1 System Novel
    2 Manager kane
    2 lawyer endun
    2 location colrado
    3 server queen
    3 system elanda
    The requirement is I need to generate a report like th follwoing
    Accountnumber firstname lastname manager lawyer System Server location
    SP456 Sridh Peter Mike schwa Novel maneka langur
    SS667 Gane San kane endun colrado
    Now I have done this report using a query where I join table1 and table2 multiple times to get the report's data. And that query only works If the user has all attributes.If any one attribut is missing it wont work.Can some onehelp me with this.
    The query i am using looks like this.
    select a.accountnumber,a.firstname,a.lastname,b.attributevalue,c.attributevalue, d.attributevalue, e.attributevalue,f.attributevalue from table1 a,table2 b where a.id=b.id and a.id=c.id and a.id=d.id and a.id=e.id and a.id=f.id and b.attributename ='manager' and c.attributename ='lawyer' and d.attributename='system' and e.attributename='server' and f.attributename='location'
    this query works well if a user has all attributes ,if any one is missing he is not shown in the report.Can some one suggest me a good way of querying than this.
    The query I am using is also taking lot of time..I think I have explained my question well ,please reply if you have questions.
    Thanks for reading till here patiently,
    Pandu

    ....if this .....
    <DIV><B>
    <P><FONT face=Tahoma size=2>select</FONT></B><FONT size=2><FONT face=Tahoma>
    Accountnumber||</FONT><FONT face=Tahoma>' '||firstname||' '||lastname||'
    '||manager||' '||<B>System</B>||' '||Server||' '</FONT></FONT><FONT face=Tahoma
    size=2>||location<BR><B>from<SPAN
    class=940214002-13042006>     </SPAN></B>(<B>select</B>
    * <BR><B><SPAN
    class=940214002-13042006>             
    </SPAN>from<SPAN class=940214002-13042006>  </SPAN></B>(<B>select</B> '1'
    id, 'Sridh' firstname, 'Peter' lastname, 'SP456'</FONT><FONT face=Tahoma size=2>
    accountnumber <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                        
    </SPAN>select</B> '2' id, 'Gane' firstname, 'San' lastname, 'SS667'</FONT><FONT
    face=Tahoma size=2> accountnumber <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                          </SPAN>select</B>
    '3' id, 'Sway' firstname, 'patel' lastname, 'PP345'</FONT><FONT face=Tahoma
    size=2> accountnumber <B>from</B> dual) x,<BR><BR><SPAN
    class=940214002-13042006>           
    </SPAN>(<B>select</B> * <BR><B><SPAN
    class=940214002-13042006>             </SPAN>from</B>
    (<B>select</B> id,<BR><SPAN
    class=940214002-13042006>                                  </SPAN>attributename,<BR><SPAN
    class=940214002-13042006>                                 
    </SPAN>lead(attributevalue,0</FONT><FONT face=Tahoma size=2>) over (<SPAN
    class=940214002-13042006><STRONG>partition by </STRONG>id </SPAN><B>order</B>
    <B>by</B> id) <B>as</B> Manager,<BR><SPAN
    class=940214002-13042006>                                 
    </SPAN>lead(attributevalue,1</FONT><FONT face=Tahoma size=2>) over (<B><SPAN
    class=940214002-13042006><STRONG>partition by </STRONG>id </SPAN><B>order</B>
    <B>by</B> id</B>) <B>as</B> Lawyer,<BR><SPAN
    class=940214002-13042006>                                 
    </SPAN>lead(attributevalue,2</FONT><FONT face=Tahoma size=2>) over (<B><SPAN
    class=940214002-13042006><STRONG>partition by </STRONG>id </SPAN><B>order</B>
    <B>by</B> id</B>) <B>as</B> System,<BR><SPAN
    class=940214002-13042006>                                 
    </SPAN>lead(attributevalue,3</FONT><FONT face=Tahoma size=2>) over (<B><SPAN
    class=940214002-13042006><STRONG>partition by </STRONG>id </SPAN><B>order</B>
    <B>by</B> id<SPAN class=940214002-13042006>)</SPAN></B> <B>as</B>
    Server,<BR><SPAN
    class=940214002-13042006>                                 
    </SPAN>lead(attributevalue,4</FONT><FONT size=2><FONT face=Tahoma>) over
    (<B><SPAN class=940214002-13042006><STRONG>partition by </STRONG>id
    </SPAN><B>order</B> <B>by</B> id</B>) <B>as</B> Location<BR><B><SPAN
    class=940214002-13042006>                     
    </SPAN>from</B> (<B>select</B> *<SPAN class=940214002-13042006>
    </SPAN></FONT></FONT><FONT size=+0><FONT face=Tahoma><FONT size=2><B>from</B>
    (<B>select</B> '1' id, 'Manager' attributename, 'Mike'</FONT></FONT></FONT><FONT
    face=Tahoma size=2> attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                       </SPAN>select</B>
    '1' id, 'Lawyer' attributename, 'Schwa'</FONT><FONT face=Tahoma size=2>
    attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                       </SPAN>select</B>
    '1' id, 'Server' attributename, 'maneka'</FONT><FONT face=Tahoma size=2>
    attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                      
    </SPAN>select</B> '1' id, 'location' attributename, 'langur'</FONT><FONT
    face=Tahoma size=2> attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                      
    </SPAN>select</B> '1' id, 'System' attributename, 'Novel'</FONT><FONT
    face=Tahoma size=2> attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                       </SPAN>select</B>
    '2' id, 'Manager' attributename, 'kane'</FONT><FONT face=Tahoma size=2>
    attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                       </SPAN>select</B>
    '2' id, 'lawyer' attributename, 'endun'</FONT><FONT face=Tahoma size=2>
    attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                      
    </SPAN>select</B> '2' id, 'location' attributename, 'colrado'</FONT><FONT
    face=Tahoma size=2> attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                       </SPAN>select</B>
    '3' id, 'server' attributename, 'queen'</FONT><FONT face=Tahoma size=2>
    attributevalue <B>from</B> dual <B>union</B><BR><B><SPAN
    class=940214002-13042006>                                                       </SPAN>select</B>
    '3' id, 'system' attributename, 'elanda'</FONT><FONT face=Tahoma size=2>
    attributevalue <B>from</B> dual)<BR><B><SPAN
    class=940214002-13042006>                                </SPAN>order</B>
    <B>by</B> id, (<B>case</B> <B>when</B> attributename='Manager' <B>then</B>
    1</FONT><FONT face=Tahoma size=2> <BR><B><SPAN
    class=940214002-13042006>                                                            
    </SPAN>when</B> attributename='Lawyer' <B>then</B> 2</FONT><FONT face=Tahoma
    size=2> <BR><B><SPAN
    class=940214002-13042006>                                                            
    </SPAN>when</B> attributename='System' <B>then</B> 3</FONT><FONT face=Tahoma
    size=2> <BR><B><SPAN
    class=940214002-13042006>                                                            
    </SPAN>when</B> attributename='Server' <B>then</B> 4</FONT><FONT face=Tahoma
    size=2> <BR><B><SPAN
    class=940214002-13042006>                                                            
    </SPAN>when</B> attributename='Location' <B>then</B> 5</FONT><FONT
    face=Tahoma><FONT size=2> <B>end</B>) <B>asc</B>))<BR><B><SPAN
    class=940214002-13042006>           
    </SPAN>where</B> attributename='Manager'</FONT></FONT><FONT face=Tahoma size=2>)
    y<BR><B>where</B> x.id(+)=y.id)</FONT></P></DIV>
    < Jonel

  • Crosstab two joined tables multiplies the data in each column ....

    below is code that crosstabs monthy sales numbers and totals for each month.  So what I need to do is add a column that totals last years sales (table will be called [2013]) and add a column called 2013 YTD. I also need to add a calculation column that
    calculates growth from one year to another. So I join the 2013 table and add one last line that sums 2013 sales but i need only Jan-Mar at this point. in other words I just need to see the total sales for each dealer from 2013 Jan-Mar while still viewing Jan-Dec
    for the current year. So looking at the end product I need to see the Dealer Info, Jan, Feb, Mar, Apr......and at the end 2013 Sales and Growth. Thus, the Where clause. Unfortunately, each months sales are multiplied x 3 with or without the 2013 sum line.
    As soon as I join the tables the numbers get multiplied.
    What am I missing??????
    SELECT    
    substring([2014].Dealer,18,50)AS
    [Dealer Name],substring([2014].Dealer,9,1)AS
    [District],substring([2014].Dealer,11,6)AS
    [Dealer Code],
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 1 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Jan,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 2 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Feb,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 3 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Mar,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 4 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Apr,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 5 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS May,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 6 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Jun,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 7 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Jul,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 8 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Aug,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 9 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Sep,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 10 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Oct,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 11 THEN
    [2014].[Sales Count]
    ELSE 0 END)
    AS Nov,
    SUM(CASE
    WHEN [2014].[Transaction Sales Month]
    = 12 THEN
    [2014].[Sales Count]
    ELSE 0 END
    AS
    Dec,
    SUM([2014].[Sales Count])
    AS [2014 Total],
    FROM        
    dbo.[2014]
    GROUP
    BY substring([2014].Dealer,18,50),substring([2014].Dealer,9,1),substring([2014].Dealer,11,6)

    This needs to be moved to Transact-SQL forum. You may want to post DDL of your tables, some input data (as insert statements) and desired output.
    In the meantime I think you'll find this blog post helpful:
    Aggregates with multiple tables
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to avoid uncompressing bitmapDatas multiple times

    Hi,
    Not sure if this should go here (performance) or IOS section, since I mainly have this issue on iOS but I think its on all air players.
    When a bitmap (for exemple a bitmap in a fla) is added, you can see with Adobe SCOUT (great tool btw!) that it is uncompressed when added. Allright.
    The bad thing is, if it is removed from stage, even if you keep it in memory for reuse, it is very often re-uncompressed when redisplayed. I mean 'often' because it seems erratic. If it stay removed for just a second, most of the time it won't be uncompressed again, but after 3 or more seconds, most of the time it will be (some kind of garbage collector in the "video" memory ?)
    Setting its quality to lossless in the fla helps the decompression goes a bit faster (30-40 % I would say), on the detriment of swf size, but does not solve the main question : how can I force an animation (made of bitmaps for example) to never be uncompressed again as long as I dont tell it to to be "disposed" from wherever this is stored ?
    Having it permanently on screen hidden somewhere is just too much a performance killer to be considered a solution when you have many. CacheAsBitmapMatrix could be usefull for vector data  on this issue (not sure), but drawing a bitmap seems a bit stupid if you do already have bitmaps.
    It might not seem a big issue but in a game with effects etc. most of those will only show up once every 2 to 10 seconds, but if you loose 5ms/frame for 40 frames each time one does, and you have many, it really impact performance on devices like ios etc, whereas memory doesnt seem to be the problem here, it happens with low or high memory usage both.
    If anyone knows a tip, thanks a lot!
    EDIT : Tests made with gpu mode, flash builder 4.7, air 3.5, iPad3 (or other), release build.

    In my experience, the second solution here: actionscript 3 - Bitmaps Being Cached As Bitmaps - Stack Overflow is the one that gave me best results thus far, even when loading a swf (as opposed to a bitmap) which contains bitmaps inside. To avoid this decompressing on the run (on demand) you can instead request flash to decompress it on load. This will increase the load time but improve the perceived performance of the app since a separate thread takes care of the decompressing. This of course means no jitter or skip when the image hits the screen:
    var fileLocation:URLRequest = new URLRequest(levelToLoad);
    levelToLoad = "testLevel.swf";
    var levelLoader:Loader = new Loader();
    var loaderContext:LoaderContext = new LoaderContext();
    loaderContext.imageDecodingPolicy = ImageDecodingPolicy.ON_LOAD;
    levelLoader.load(fileLocation, loaderContext);
    Embedded images (via code) are not supposed to be compressed, so this problem shouldn't occur with applications that do so. However, if you are like me, and you use the Flash Pro IDE to import PNGs or other bitmap assets, Flash Pro compresses them as JPG by default, using the setting provided by the image itself.
    To fix this and avoid these decompression issues, simply go to your Flash Pro asset library, right click on the image you want to change, click on properties and select "lossless / PNG/GIF" as compression. This will increase largely the load time but you will have the much better perceived performance discussed here. This should be done in addition to implementing the code above, or it will make no difference.
    In my experience the frame rate average dropped only by one frame per second, but it's much more consistent without any skips or lags which is essential for games.
    See: http://help.adobe.com/en_US/as3/dev/WS52621785137562065a8e668112d98c8c4df-8000.html
    And
    http://www.bytearray.org/?p=2931

  • How to include a table multiple times in InfoSet Query

    Hi,
    Is it possible to include a table more than once in an InfoSet Query, I created an InfoSet Query and Include Table A, then included Table B now i want to join Column 1 and 3 of Table A to be join with column1 of Table B, in other words, Table B is a Master data table, and Table A is a transaction data table, how this can be acheived.
    Thanks
    Akila. R

    You cannot achieve this.
    Instead, compound the column 1 with column 3 info objects and create join with Table B.
    This will result in same intended functionality.

  • Reference another table multiple times in one formula problem

    I trying to pull data from another table, e.g. with "table 1 :: $b$6" - my problem is, this works just fine for one or perhaps two references, but when I get past that, Numbers refuses to convert e.g. "table 1 :: $b$8" to the value from that cell.
    I'm I perhaps doing something wrong here? or is there a max to the number of references I can create?

    Here it behaves flawlessly.
    May be a localization oddity.
    Ttry to run Numbers from an other user account.
    If it behaves well we will know that the wrongdoer is in your original account.
    If it's the case,
    quit Numbers
    move its preferences file :
    <startupVolume>:Users:<yourAccount>:Library:Preferences:com.apple.iWork.Numbers. plist
    on the Desktop.
    Run Numbers.
    If it behaves flawlessly your preferences file was corupted.
    Yvan KOENIG (VALLAURIS, France) jeudi 13 mai 2010 23:07:42

  • How to avoid User Authentication Multiple times after run the Bo report

    Dear Experts,
    I am facing issue in BOBJ portal. we are trying to run report in portal and its working fine and running ME23N transaction from that report.
    Once we click on ME23N transacation from that report its opening new pop up window and data showing perfectly .
    But after close that pop up window and go back BO or BI TAB in portal its asking uid and password.
    But first time it's not asking. If I log out and login again then it will work but after run and close the pop up window and come back to BI or BO tab again is asking user ID and Password.
    I checked all Log on tickets and validity period and system connections every thing fine.
    Could you please Help me ...
    Regards
    Kalyan

    Hi Kalyan
    Is this any internet proxy server setting are there in browser? just bypass the proxy setting and then try the same
    BR
    SS

  • DB Adapter: Polling For New Records returns the First record multiple Times

    I Polling for New or Chnaged Records against DB2 on iSeries. The DB Adapter returns the first record from the Table multiple Times. If the Table has 5 records it displays the first record 5 times. I am using BPEL 10.1.3.1 Can anyone help me with this.

    Hi there,
    please check out the DBAdapter trouble-shooting guide:
    http://download-east.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/app_trblshoot.htm#CIHFEHFA
    I am copying an entry from there into here:
    A.1.21 Some Queried Rows Appear Twice or Not at All in the Query Result
    Problem
    When you execute a query, you may get the correct number of rows, but some rows appear multiple times and others do not appear at all.
    This behavior is typically because the primary key is configured incorrectly. If the database adapter reads two different rows that it thinks are the same (for example, the same primary key), then it writes both rows into the same instance and the first row's values are overwritten by the second row's values.
    Solution
    Open Application Sources > TopLink > TopLink Mappings. In the Structure window, double-click PHONES. On the first page, you should see Primary Keys. Make sure that the correct columns are selected to make a unique constraint.
    Save and then edit the database partner link.
    Click Next to the end, and then click Finish and Close.
    Open your toplink_mappings.xml file. For the PHONES descriptor, you should see something like this:
    <primary-key-fields>
    <field>PHONES.ID1</field>
    <field>PHONES.ID2</field>
    </primary-key-fields>
    Thanks
    Steve

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • Join same table 3 times, count from two other tables

    Hi all!
    I have 3 tables
    RECORDS
    Id, Record_Id
    ITEMS
    Id, Record_Id
    ARTICLES
    Id, Record_Id
    I need to join RECORDS table 3 times R1,R2,R3 and get count of items R2 and R3 have and count articles that R3 has.
    R2 must have ITEMS and R3 must have items, R3 may have articles. R1 may have multiple children and R2 may have multiple children.
    Solution I'm using is following, but distinct makes it slow...
    select r1 as ParentRecordId,count(distinct i1) as Volumes,count(distinct i2) as Numbers, count(distinct a1) as Articles
    from
        select r1.id as r1,i1.id as i1,i2.id as i2,a.id as a1
        from records r1 inner join records r2 on r1.id=r2.record_id
        inner join records r3 on r2.id=r3.record_id
        inner join items i1 on r2.id=i1.record_id
        inner join items i2 on r3.id=i2.record_id
        left join articles a on a.record_id=r3.id
    ) as sel
    group by r1
    order by 1
    Regards
    Meelis

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. And thanks for no sample, too! 
    >> I have 3 tables <<
    No, you have three identical decks of 1950's punch cards written in bad SQL. 
    There is no such thing as a generic, universal “id” in RDBMS. It has to be the identifier of something particular. 
    Magical columns appear in your query. 
    There is no such concept as “child' and “parent” in RDBMS. That was network and hierarchical databases. We have referenced and referencing tables. 
    We do not use column positions in the ORDER BY cause; any change in the query used in the cursor will screw up everything. 
    Would you like to try again? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Display specific row to display multiple time in jsf table 11.1.1.2.0 with

    HI ALL,
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I have to display the values in jsf frm table where i'm using DislayCertDetailVO . In dis VO i'm having a column no.of certificaties .taking dis column value when i navigate to other page jsf by selecting a specific row. here i have to display the selected row in multiple times based on the no.of.certificates column value.
    I want to display specific row to display multiple time to repeat same row in a table in jsf based on the value from bean or table in database.
    Edited by: user9010551 on Apr 28, 2010 6:14 AM
    Edited by: user9010551 on Apr 28, 2010 10:33 PM

    Hi, Trying it once more to give more clarity of my scenario.
    I have to navigate from 1 screen to the other by picking a given table record/row from the 1st screen. While displaying the record on the 2nd screen the catch is that, I have to display it as many times as the value in a cell of the selected record.
    eg.
    screen 1
    col1   col2     col3
    2 order1 item1
    [next]
    On clicking next it should look like
    screen2
    col1           col2            col3           col4
    order1 item1
    order1 item1
    where col3 and col4 will be editable by the user and col1 is the value depends how many times i have repeat the row/record
    Hope this give more clarity.

  • Left outer join using multiple table

    Hi,
    I am trying to use left outer join with multiple tables , the join condition will be based on  PERNR and BEGDA & ENDA for each infotype in selection screen.
      select pa00~pernr pa00~begda pa00~endda pa00~massn pa00~massg pa00~stat2 pa00~aedtm pa00~uname
        pa01~begda pa01~endda pa01~bukrs pa01~persg pa01~persk pa01~mstbr pa01~ename pa01~aedtm pa01~uname
        pa02~begda pa02~endda pa02~nachn pa02~vorna pa02~midnm pa02~aedtm pa02~uname
        pa016~begda pa016~endda pa016~cttyp pa016~aedtm pa016~uname
        into CORRESPONDING FIELDS OF TABLE i_pall
        from  ( PA0000 as pa00 left OUTER JOIN pa0001 as pa01 on pa00~pernr = pa01~pernr )
        left OUTER JOIN pa0002 as pa02 on pa00~pernr eq pa02~pernr )
        left OUTER JOIN  pa0016 as pa016 on pa00~pernr eq pa016~pernr )
        where pa00~pernr in S_pernr
        AND pa00~begda in s_bg0000
        and pa00~endda in s_nd0000.
    but this fails  to fetch the value of begda enda from each pa0000,pa0001,pa0002,pa0016.
    Please help!
    Monirul

    Why don't you use the standard logical database PNPCE and then Provide statement?

  • Oracle outer join on  multiple tables throws error

    Hi ,
    We are using ansi joins with outer joins on multiple tables in oracle 9i.
    Now these queries have to be used in Oracle8i.
    Since Oracle8i does not support ansi sql we are replacing the ansi sql queries with the oracle joins.
    On trying the same we found that the following query
    select *from tab1 a, tab2 b, tab3 c where a.c1 = b.col1(+) and c.c2 = b.col2 (+)
    throws the error
    ORA-01417: a table may be outer joined to at most one other table.
    Is there a way to simulate this query without using the outer joins on multiple tables?
    thanks

    Try writing the query in this form:
    select * from
    (select t1.col1, t1.col2
    from schema.table1 t1, schema.table2 t2
    where t1.col1 = t2.col1(+)) t4,
    schema.table3 t3 where t4.col2 = t3.col2(+)
    In the subquery, you will have to list all the columns you want to see, and you will need to provide unique aliases for any columns with duplicate names. I tested this on 9i, and don't have an 8i system to work with, so I hope this helps.

  • Columns in af:table rendering multiple times when filtering drop-down list

    Technology: JDeveloper 10.1.3.0.4 SU5, ADF Faces/BC
    Page design:
    Master-detail jspx.
    Each section is an af:table.
    Drop-down lists created using instructions from http://www.oracle.com/technology/products/jdev/tips/muench/screencasts/editabletabledropdown/dropdownlistineditabletable.html?_template=/ocom/technology/content/print
    Requirement:
    Data in a drop-down list on a child record needs to be filtered based on data from one or more columns in the currently selected row of the parent record.
    Issue:
    Drop-down lists have been successfully filtered using a couple of different methods, however, any time the data from the parent record is used to filter the data the columns in the child af:table begin to render multiple times. Navigating through the parent rows may cause the child records to have the correct number of columns displayed or multiple copies of the columns displayed.
    Removing any reference to the parent view object and hard-coding values instead causes this behavior to disappear.
    Each of the following methods has been tried. Each filters drop-down list data correctly and each causes apparently random extra column renders.
    1.     Cascading lists as per: http://www.oracle.com/technology/products/jdev/tips/mills/cascading_lists.html
    2.     Drop-down list based on view object that takes parameters.
    3.     Set where clause for drop down list in a method on the app module.
    4.     Set where clause for drop-down list in a new selection listener method for the af:table.
    Question:
    Is there a solution available that will filter the drop-down lists correctly and prevent the extra columns from being rendered?
    Thank you for any help that you can provide,
    Joanne

    bump

  • Valuechange listener called multiple times for checkbox in table.

    Hi All,
    I'm trying to understand how value change listeners work for checkbox components within a table column. I have a checkbox declared as below
    <af:selectBooleanCheckbox id="sbc1"
    valueChangeListener="#{pageFlowScope.classfiyBean.checkBoxValueChangeListener}"
    immediate="true"
    autoSubmit="true" />
    I notice the value change listener is called multiple times. There are 6 rows in the table within which the checkbox is a component. It is called 6 times for a change. How do I prevent this from happening as it's over writing the values of the other rows as well.
    Scenario : The page is based on a human task, so the outcome button cannot be set to Immediate = true since there are other validations on the page.
    JDev: 11.1.1.4
    Thanks
    PP

    Hi
    Please make sure that Is there any logic being implemented in WD MODIFY VIEW of view controller.
    If yes that may be the cause of your problem because WDModifyView() is being called every time u perform an action.
    or
    Try to Invalidate current context node which is bound to table UI element and actually containing data at run time. I think this node is not being refreshed. Try to refresh it in Search Button action.
    or
    Check your loop code snippet, if you implemented it anywhere.
    Mandeep Virk

Maybe you are looking for

  • Itunes wont launch with windows 7

    I downloaded the new version of itunes and 2 days later updated my computer (Windows 7) and my itunes no longer worked. I uninstalled and re-installed and tryed many times. I came back to my computer earlyer and itunes was open and i accidently close

  • Calling webservice from webdynpro thru model(webservice created from BAPI)

    Hi all i have created one webservice from Functional module in backend system(ECC) and also i released the same webservice in backend(ECC) thru the TCODE wsconfig. my questions are 1) how to execute that created Webservice in backend system itself(EC

  • Integration Directory APIs in PI7.1

    hi, I am trying to read/access the content (objects) of integration directory using the APIs. this feature is available in PI7.1. I saw the documenation [http://help.sap.com/saphelp_nwpi71/helpdata/en/46/6ef92455d66a58e10000000a11466f/content.htm] an

  • Why is my user interface monitor resolution dependent?

    The user interface I created with Labview is screen resolution dependent. That means I built a user interface application exe on my computer. But when I run the exe on another computer with lower resolution, the application window was enlarged and so

  • I cannot send text messages to others not on my iphone4S.

    Can anyone out there help me with this? I can send text messages (imessages) to friends with a newer iphone, but no messages come in or go out to those that are not on iphones. I tried every combaination of settings in the Messages area of the settin