Doubt in forming Query

Hi,
I have a doubt in forming query.
I have a table like this
Inst_Id port1 sid port2
1 2300 1 2302
2 2304 1 2302
3 2306 1
4 2300 2
5 2306 2 2308
I need a result as for sid = 1(should take union of both port and list out with instd_id)
Port Inst_Id
2300 1
2302 1
2304 2
2306 3
Can any one help to get a query?
-haifriends

You simply answer:
select inst_id,port1 from t where sid=1
union
select inst_id,port2 from t where sid=1

Similar Messages

  • Doubts In Forms 6i

    Hi ,I've got some doubts in forms.
    1) what is the difference b/w commit and commit_form?
    2) When we've to use key triggers?What is the purpose of key-triggers?
    3) When we've to use On-triggers?
    Pls reply me asap...
    Prashanth Deshmukh

    Hello,
    You seem to have some strong problem to read (access) the online documentation...
    Commit and commit_form are the same thing.
    Key-triggers are used to intercept some...... key actions !
    On-triggers are used to replace the automatic/internal form process
    (Yhe code you place in an ON-INSERT trigger replace the Internal Forms code for each based record that have the INSERT status)
    Please, open the Forms Builder and press the Ctrl+H key, then take some time to read and learn.
    Francois

  • Doubt in sql query

    hi frs,
    i have a doubt in sql query.
    this is my query
    select * from scott.emp where comm like '3%'it will fetch all the values starting with 3.
    2nd query
    select * from scott.emp where comm like '%'this will give all the values except null. but i want to get null values also.how can i get i have used following query
    select * from scott.emp where comm like '%' or comm is not nullits working whether there is an any other option.because i am going to use similar kind of condition in my report query if iam going to use or in where condition it will affect the performance.
    pls help
    regards
    Rajesh

    Hi Rajesh,
    I'm sure I do not understand your requirement correctly.
    You say you want to retrieve rows that have or have not null in colum 'comm', right?
    If so, simply get rid of this part of your where clause (provided you have more conditions).
    select * from scott.emp shall be enough.
    Cheers,
    Guido

  • Doubts in Select query

    Hai,
    I have problem in my select query,
    My previous select query:
      SELECT  rrcty 
            ryear 
            rbukrs
            rzzpspid 
            SUM( hslvt )
            SUM( hsl01 )
            SUM( hsl02 )
            SUM( hsl03 )
            SUM( hsl04 )
            SUM( hsl05 )
            SUM( hsl06 )
            SUM( hsl07 )
            SUM( hsl08 )
            SUM( hsl09 )
            SUM( hsl10 )
            SUM( hsl11 )
            SUM( hsl12 )
            SUM( mslvt )
            SUM( msl01 )
            SUM( msl02 )
            SUM( msl03 )
            SUM( msl04 )
            SUM( msl05 )
            SUM( msl06 )
            SUM( msl07 )
            SUM( msl08 )
            SUM( msl09 )
            SUM( msl10 )
            SUM( msl11 )
            SUM( msl12 )
             FROM zzsl5t
           INTO TABLE it_erbproj
             WHERE rldnr       EQ  c_rldnr        AND
                rrcty      EQ  c_rrcty        AND
                ryear       EQ  v_srr_fyear    AND
                rbukrs      EQ  v_srr_ccode    AND
                racct      EQ  v_racct        AND
                rzzpspid  IN r_zzpspid         
             GROUP BY  RRCTY ryear RBUKRS rzzpspid.
    now i want change the above select query as,
    If user enters input period 03 means,
    i have to select
    SELECT  rrcty 
            ryear 
            rbukrs
            rzzpspid 
            SUM( hslvt )
            SUM( hsl01 )
            SUM( hsl02 )
            SUM( hsl03 )
            SUM( mslvt )
            SUM( msl01 )
            SUM( msl02 )
            SUM( msl03 )
    only, not to select all the periods.
    how can i give fields dynamically.
    please suggest me.
    Elamaran

    Duplicate message. Please close this one and look at my answer Doubt in Select query.

  • Refresh table-form query on table only

    Hello,
    I have a group being generated as a table-form layout. What I would like is for the table page to be refreshed always on entry. I can't set the group requery condition to always, or "when entering the page" as then the view object is executed going navigating from the table page to the form page. This seems a very simple requirement to me but Im struggling to come up with an elegant solution.
    Basically what i need is the refreshCondition on the invokeAction binding executable to be "Always and layout=table".
    Any help would be greatly appreciated !
    Cheers,
    Brent

    How do you do this, if your current page is a .jsff and not a .jspx? When I look at the refreshCondition, a .jsff does not have access to the facesContext.
    Thanks,
    Michelle
    Since this question was already answered, I created a new thread:
    Refresh table-form query on table only for .jsff pages
    Edited by: MSchaffer on Dec 1, 2010 11:54 AM

  • Form query/search issue F6 , F11 + Ctrl F11

    Dear Techies,
    I have an issue with form query/search mode in oracle applications. The Issue is i have a custom form which has headers and lines. whenever i open the form cursor is defaulting on a column called "Transaction_year" which is a mandatory column, Because of this whenever i want to search first I have to clear the record (Press F6) then press F11 and CTRl F11.
    And my client is irritated to press so many buttons. I cannot make mandatory col to optional since it is "Transaction_year" a primary key. I have to customize the form in such a way that it should allow f11 + ctrl f11 to search.
    Can somebody help me how can i achieve this. I am new to forms :(

    I have written this code in form level - when new form instance trigger
    go_item('XXDOF_PA_PRJCST_HEADERS.FIN_APPRVER_DEPT');
    this is a optional field ... and when when i open form it is defaulting to this ... still f11 + ctrl f11 is not working ... i have to clear it (f6) and then press f11 + ctrl f11

  • Forms & Query-Mode

    Is there any way to query the data in Application Express Forms as we can do it in Oracle Forms Query-Mode (F7 begin query, F8 execute query)?

    Hi,
    Try going to the SQL Workshop. It allows you to query the data in your schema.
    If you don't like navigating to SQL Workshop from the Application Builder, open a second browser for your queries.
    Hope this helps.
    Cheers,
    Patrick Cimolini

  • How tochange the description ofa field inthe parameter form query generator

    I have a parameter form which is fetching the details from the Location table.
    /* Select From [OLCT] T4 */
    Declare @ToLoc Varchar(300)
    /Where/
    Set @ToLoc = /* T4.Location*/ '[%4]'
    when i execute the parameter form Query selection criteria displayed is
    Name
    OLCT table the description of the field location is Name i want to change the description to location
    Please Help

    Thanks for the reply , It does not help.
    If meant the selection box when I run query to input values
    for example
    /* Select From [OINV] T1 */
    Declare @FromDate Datetime
    /Where/
    Set @FromDate = /* T1.DocDate*/ '[%1]'
    /* Select From [OINV] T2 */
    Declare @ToDate Datetime
    /Where/
    Set @ToDate = /* T2.DocDate*/ '[%2]'
    /* Select From [OLCT] T3 */
    Declare @FromLoc Varchar(300)
    /Where/
    Set @FromLoc = /* T3.Location*/ '[%3]'
    /* Select From [OLCT] T4 */
    Declare @ToLoc Varchar(300)
    /Where/
    Set @ToLoc = /* T4.Location*/ '[%4]'
    /* Select From [OLCT] T5 */
    Declare @Country Varchar(300)
    /Where/
    Set @Country = /* T5.Country*/ '[%5]'
    /* Select From [OLCT] T6 */
    Declare @State Varchar(300)
    /Where/
    Set @State = /* T6.state*/ '[%6]'
    Exec [SAP_SP_DB]..[NABC_TaxReport] 'SAP2007B','Inflow',@FromDate,@ToDate,@FromLoc,@ToLoc,@country,@state
    In the above query I have from and To Location which displays as Name in the selection box

  • Creating a database form query??? HELP?

    Hi, i want to create a rate calculator on a webpage.  I dont know much about databases and all that, please help.  I basically have an excel sheet with a list of countries calling from (with corresponding amounts with it) and list of countries calling to (with corresponding amounts with it). And basically the two numbers (calling from and calling to) have to be added to get the rate per min. An example of a rate calculator that i want to create is:  http://www.globenettroaming.com/Rates.php but like i said, i only need a calling from country drop down list and a calling to country drop down list and a calculate button.
    I really REALLY would appriciate any help.  All i know is that i have to asp - and thats it.  Please explain how i would create this database and create a form query on a web page.
    Thank you A LOT!

    mmmm, not much - i've just been reading up on the topic so im just begining to learn it all.  Well, i could use access BUT i dont know where to start and how to put in all the data etc... The hosting company i use uses mysql (????) - i havent even an idea of where to start.  Scripting language (????) - i guess ASP....Are you able to help?
    Thank you.

  • Enter Requisition Form Query - Help Needed

    Hi Forum,
    I have a requirement to modify the lov for the Category field in the Enter Requisition form and add a new field.
    The item is in the block :LINES.ITEM_CATEGORY.
    So, I ftp'd the form and libraries onto my local drive which is in the FORMS60_PATH. When I open the form, it opens without any error. But it does not attach any libraries in it ?
    Anyway, I looked at the form item and its a Text Item with a Lov 'ENABLE_LIST_LAMP' and a record Group with the same name. But this is a dummy record group.
    Where is the Actual Query for this Record Group built ? I assume it is in some library, but how do i find which library ?
    I cannot see anything in the WHEN-NEW-ITEM-INSTANCE or any other trigger having the query.
    The Category is a KFF actually.
    Thanks
    S.
    Edited by: user565538 on Mar 25, 2009 6:12 AM

    one more thing i notice is I can see in the KFF definition , the Value set = PO_ITEM_CATEGORY
    But when I try to query for this Value set (of type independent) , in System Adminsitrator, no value set is being returned !
    Am i missing something ? where are the values coming from ?

  • Doubt in Firing Query with multiple opportunities UUID/IDs

    HI Folks!
    I might have simple doubt but please help me on this!
    1. I have a custom BO with association to opportunities.
    [DeploymentUnit(CustomerRelationshipManagement)] businessobject Sy_Trade {
    [AlternativeKey] [Label("Trade Id")] element tradeid : BusinessTransactionDocumentID;
    node RelatedOpportunities [0,n]{
                                  element BusinessTransactionDocumentReference : BusinessTransactionDocumentReference;
                                  element BusinessTransactionDocumentRelationshipRoleCode : BusinessTransactionDocumentRelationshipRoleCode;
                                   association RelatedOpportunity[0,1] to Opportunity;
    2. I have success fully used association and i am able to view create all the opportunities related to my custom Bo.
    ISSUE : I want a facet where i just want DISPLAY the activities and sales document assigned in the RELATED OPPORTUNITIES ( N opportunities )
    How do i query with Multiple opportunities ID and fetch the activities against it?
    Btw I want to use query in UI Designer... I have created an  advanced list pane and there i want the result list
    I hope i am clear!
    Thanks in adavance...
    Regards
    Dhruvin

    Hi Ludger,
    I have successfully displayed Related Opportunities associated with trade.( i am able to create , delete also )
    Issue : I am not able to "Display" ( i don't need to edit or create ) all the activities created against all the opportunities in a different tab.
    I tried to approaches :
    1: Query : Created a Query on Activity BO and tried to pass multiple related opportunities ( but seems not possible , please tell me any possibility to pass range of opportunity via transformation or anything? )
    2 : binding : I have a Node Related Opportunity so just tried to bind it with BO model but problem is it is displaying all the activities of first opportunity of the list...
    i think why because :
    In Data model I have created a table bind with Related Opportunities...
    now that node is 1 to N , association to opportunity 0 to 1 , hence i think it fetches only 1 opportunities activity
    should i create like below ( Or is it possible)
    Node Reltdoppts[0,1]
    association [0,N] to opportunity BO ?
    Although i strongly feel SAP should provied us two things :
    1. We need to pass range of opportunities in a query.
    2. We need to just write some absl code where i can fill the table and display it
    and also is there any possibility to create a report or something to display activities as we just want to display the activities!
    P.S : I have been getting a lot of bashing from client because some of the product restriction in cloud! i hope and wish SAP give developers free hand to develop right now its like our hands are tied to many things

  • Doubt in sub-query

    I have a doubt with the use of sub-queries. I am using a query like as below & it is giving me expected result:-
    SELECT ISS.item_type_id,count(1) + (select sum(invoiced_qty) from ppbs_invoice_detail where
    trunc(created_date) between '01-jul-05' and '04-jul-05' and item_type_id=ISS.item_type_id) qty
    FROM ppbs_INV_SIM_SERIAL ISS
    WHERE INSTR('ROAAIT',STATUS)>0
    AND INSTR('NU0NU1NU2NU3SC0',CITY_CODE) =0
    and ISS.item_type_id in ('SM17')
    group by ISS.item_type_id --
    I will re-write above query & i have been using queries like :-
    SELECT ISS.item_type_id,count(1) qty
    FROM ppbs_INV_SIM_SERIAL ISS
    WHERE INSTR('ROAAIT',STATUS)>0
    AND INSTR('NU0NU1NU2NU3SC0',CITY_CODE) =0
    and ISS.item_type_id in ('SM17') and item_type_id in
    (select item_type_id from ppbs_invoice_detail where
    trunc(created_date) between '01-jul-05' and '04-jul-05' and item_type_id=ISS.item_type_id)
    group by ISS.item_type_id
    my doubt here is that the sub-query in the first query is coming before i use the table 'ppbs_inv_sim_serial ISS' whereas in the second query, the table use 'ppbs_inv_sim_serial ISS' is coming before the sub-query use. I have been using queries where table name is defined before the sub-query.
    I hope, my question is clear. Please help in solving the doubt.
    Regards.

    I don't see a problem with the table aliasing that you seem to doubt, but your first query won't run. I boiled the thing down to basics: SQL>create table t1 (one number, val_1 number );
    Table created.
    SQL>create table t2 (one number, val_2 number );
    Table created.
    SQL>insert into t1 values (1,1);
    1 row created.
    SQL>insert into t2 values (1,2);
    1 row created.
    SQL>select a.one, count(1) + ( select sum(val_2) from t2 where t2.one = a.one) qty
      2  from  t1 a
      3  group by one;
    select a.one, count(1) + ( select sum(val_2) from t2 where t2.one = a.one) qty
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    SQL>
    SQL>select a.one, count(1) qty
      2  from   t1 a
      3  where  a.one in ( select one from t2 where one = a.one)
      4  group by one;
           ONE        QTY
             1          1It's superfluous to "where a.one in ( select.. where = a.one) but that's your code basically. I would just do "="

  • Doubt in Form Template Customization Using VSTA

    Hi All,
    i have doubt in InfoPath form development using VSTA.
    I have one form template, i want to auto fill(Using Hard coded) some of fields in that form like name,date and mobile number.
    Can any one help me out how to do that.
    Thanks in advance!

    Hello,
    No need to use VSTA if you just want to set hardcode values. You need to set rule on form load event. Refer this link to set field value on form load:
    http://www.bizsupportonline.net/infopath2007/infopath-basics-how-to-populate-form-when-opened-loaded.htm
    Anyway if you want to auto populate user detail from sharepoint then use userprofileservice.asmx service. (YOu will need to create user profile service in your farm to leverage this)
    https://askmanisha.wordpress.com/2013/07/22/how-to-set-current-user-details-in-an-info-path-form/
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Tabular form query using column values delimiter

    I wanted to know, if i can query a tabular block by entering the column values (primary key) as semicolon delimited and update required fields. Please let me know.
    Requirement:-
    User will enter 5 values as "AB1; AB2; AB3; AB4; AB5"
    After entering I need to write a plsql code to query the tabular form as follows
    PrimaryCol SecCol
    AB1 IN
    AB2 IN
    AB3 OUT
    AB4 IN
    AB5 ON
    Then I will update the columns accordingly.
    Please help me.

    You could put something like this in the WHERE-clause (assuming that :BLOCK.QUERYDATA contains your value AB1;AB2;AB3;AB4; )
    INSTR (';' || PK_COLUMN || ';', ';' || :BLOCK.QUERYDATA || ';')>0Maybe you have to additionally eliminate space in :BLOCK.QUERYDATA

  • Form query too long running

    I am dealing with an issue that I believe I have boiled it down to being a Forms issue. One of my developers has a form that is taking 40+ minutes to run a pretty complicated query. At first I believed that it was a query or development issue, however the same query can be ran from Toad or from SQLPlus in under a few seconds. I have even ran the query from SQLPlus on the forms server with the same speedy performance. The only environment in which this query takes almost an hour to run is if it is ran from her .FMX ... I am soooooo at a loss right now as to what I could do to fix this. Has anyone experienced something of this nature?
    Additionally the query returns ZERO results and this is an expected outcome so I don't believe it has to do with Toad buffering or SQLPlus return the rows as they are fetched. Anyway I'm at a loss and any help what-so-ever will be greatly appreciated.

    To show what can go wrong look at this simple example.
    HR@> CREATE TABLE a (ID VARCHAR2(10) PRIMARY KEY);
    Table created.
    HR@>
    HR@> insert into a select rownum from dual connect by rownum <= 1e6;
    1000000 rows created.
    HR@>
    HR@> set timing on
    HR@>
    HR@> select * from a where id = 100;
    ID
    100
    Elapsed: 00:00:00.34
    HR@>
    HR@> select * from a where id = '100';
    ID
    100
    Elapsed: 00:00:00.00
    HR@> explain plan for
      2* select * from a where id = 100
    HR@>
    HR@> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 2248738933
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |     7 |   522  (12)| 00:00:07 |
    |*  1 |  TABLE ACCESS FULL| A    |     1 |     7 |   522  (12)| 00:00:07 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
       1 - filter(TO_NUMBER("ID")=100)Because of implicit conversion (as explain plan shows) select * from a where id = 100 takes longer than select * from a where id = '100'.

Maybe you are looking for