Query need for following question

ORD :
ORD_ID
ORD_DATE
CUST_ID
ORD_TOTAL
CUST :
CUST_ID
CUST_NAME
CITY
Quest:
ORD_ID either less than 10 or greate than 50 also ORD_TOTAL >5000 ?

What have you tried yourself sofar?
And again:
Quit polluting this forum, please.
You're not providing any details reqarding your requirement, database version and so on...
Read: http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
And use CREATE TABLE + INSERT INTO statements, formatted by using the {noformat}{noformat}tag when you want to post an example.
For example, if you post:
{noformat} select *
from emp;
{noformat}
it will appear as: select *
from emp;
on this forum.
Tags are explained in the FAQ, so read that too: http://forums.oracle.com/forums/help.jspa                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Need the answers for following questions?

    can anybody  say the answers  for following questions?
    Data Dictionary :
    1) Diff between Append Structure and Include Structure ?
    2) What is Table Type ?
    3) How the table entries are going to store, Is it Case sensitive, or in Capital Letter or in Small letter or as we give ?
    4) How many indexes we can give for a table ?
    Reports :
    1) How can we enable the verticle scroll in a table control that comes in 2 nd screen of ME 21 T.code ?
    2) What is BSEG table  ?
    3) How can you create Table Control ?
    4) Diff between At Selection Screen on Field & At selection Screen Output ?
    5) What are things we need to take care before using the Read Statement ?Example of Read Statement with Index ?
    6) How many ways are there to select a Particular Data from the table ?
    7) I want fetch the 10 th row and 5 th column from the list, How will you do it ?
    BDC :
      1) If we write Transaction Statement 2 times for a application What happens ?
      2) If for Example , I had to upload 10 items for one header. The 5 items are uploaded, but the Sixth record is not uploaded ? How can you upload that data from 6 th Record ?
    3) Tell me the Detail Steps in uploading the Data from Application Server ?
    4) One Scenario, i am having 10 records in a file & when i am uploading the data everytime the 1st record is overlapping with already existing data, How you are going to handle this  ?
    5) What is meant by MASK in Upload function ?
    6) what are the parameters you will pass withine BDC_INSERT ?
    SAP- Script :
    1) I want to display quantity & Price based on Particular Language and Country in SAP Script , How we can do that ? One particular statement is there for that, What is that ?
    2) The Logo Upaloaded got Inverted , then How you are going to handle this situation ?
    3) The logo uploaded using RSTXLDMC programe, Where it is going to store ?
    4) can we see Tiff files in SE 78 T.code ? What are the file extension of Logo we can upload to SAP
    5) How to check the changes made in the standard layout set , other than using Utilities--- -> Print preveiw ?
    User Exit :
    1) Suppose i have used a fuction Module Exit, But is in Inactive status , What is The error it is going to give during runtime ?
    2) Suppose i want to delete the Function Module exit from one project and i want to use it for another project ? what are steps you follow to delete it  ?
    BADI
    1) Is that all the Predefined BADI's present  in SAP are reusable ?

    Data Dictionary :
    1) Diff between Append Structure and Include Structure ?
    Append Structure - This structure can be used only one time to append. Append structures are useful for standard tables.
    Include Structure - This structure can be used in multiple tables. Include structures are useful for our own custom tables.
    2) What is Table Type ?
    A table type is a type that describes the structure and functions of an internal table in the ABAP program. In simple words table table will act as an internal table without header line.
    3) How the table entries are going to store, Is it Case sensitive, or in Capital Letter or in Small letter or as we give ?
    Yes it is case sensitive.
    Use translate statement to convert Upper case or Lower case.
    4) How many indexes we can give for a table ?
    1 primary index automatically created and we can create up to 15 secondary indexes.
    Reports :
    1) How can we enable the verticle scroll in a table control that comes in 2 nd screen of ME 21 T.code ?
    set <tablecontrol>-lines = 0.this code you have to put in one suitable userexit.then it applies to standard tcode ME21N.
    2) What is BSEG table ?
    BSEG table is a FI table for Accounting Document details.
    3) How can you create Table Control ?
    controls : tabcont type tableview using screen '3000'.
    PROCESS AFTER INPUT
    MODULE mod AT EXIT-COMMAND.
    LOOP AT itab_table or LOOP "depending on whether we are using AT int_table
    MODULE modify_int_table.
    ENDLOOP.
    MODULE user_command.
    4) Diff between At Selection Screen on Field & At selection Screen Output ?
    AT-SELECTION SCREEN ON FIELD
    is to validate a particular selection screen field.
    if any error comes it will open only this field and other fields will be disabled.
    AT-SELECTION SCREEN OUTPUT
    is used to do dynamic screen modifications on the screen.
    5) What are things we need to take care before using the Read Statement ?Example of Read Statement with Index ?
    do sort before read data from table.
    6) How many ways are there to select a Particular Data from the table ?
    using views or directly u can select data.
    7) I want fetch the 10 th row and 5 th column from the list, How will you do it ?
    sorry...
    BDC :
    1) If we write Transaction Statement 2 times for a application What happens ?
    i think u got message like already that transaction was called like this..
    2) If for Example , I had to upload 10 items for one header. The 5 items are uploaded, but the Sixth record is not uploaded ? How can you upload that data from 6 th Record ?
    within the loop u have to write the code for the 6th record and then process again.
    3) Tell me the Detail Steps in uploading the Data from Application Server ?
    use DATASETS for uploading data from application server.
    4) One Scenario, i am having 10 records in a file & when i am uploading the data everytime the 1st record is overlapping with already existing data, How you are going to handle this ?
    write CLEAR statement before endloop.
    5) What is meant by MASK in Upload function ?
    sorry...
    6) what are the parameters you will pass withine BDC_INSERT ?
    TCODE-import parameter
    DYNPROTAB-tables parameter
    SAP- Script :
    1) I want to display quantity & Price based on Particular Language and Country in SAP Script , How we can do that ?
    One particular statement is there for that, What is that ?
    Actually u will get quantity and price based on language using SE63 transaction.it is used for language conversion.
    2) The Logo Upaloaded got Inverted , then How you are going to handle this situation ?
    just check the printer settings again.
    3) The logo uploaded using RSTXLDMC programe, Where it is going to store ?
    STXBITMAPS is the table which stores all the logos.
    4) can we see Tiff files in SE 78 T.code ? What are the file extension of Logo we can upload to SAP
    No we cannot upload .tiff files using SE78 ..here u can upload only bmp and jpg logos...if u want to upload .tiff files go to standard program RSTXLDMC..by using this you can do.
    5) How to check the changes made in the standard layout set , other than using Utilities--- -> Print preveiw ?
    by executing the formprogram.
    User Exit :
    1) Suppose i have used a fuction Module Exit, But is in Inactive status , What is The error it is going to give during runtime ?
    u didn't get any error message but that functionality cannot applied to it..thats it.
    2) Suppose i want to delete the Function Module exit from one project and i want to use it for another project ? what are steps you follow to delete it ?
    first go to that perticular project..within this u have one enhancement..just click on that one...and go to that function module which u are assigned..remove the code and activate..delete enhancement and activate that project..now u can use that enhancement in other projects.
    BADI
    1) Is that all the Predefined BADI's present in SAP are reusable ?
    here reusable means u can do multiple implementations for all BADI's.
    Rewards if it helpful.
    Dara.

  • Answers needed for my questions

    Hello,
    I need answers for few questions.It helps me a lot.It may be very basics but kindly answer me.
    )How do you view the value of the parameter that is being used by instance?
    show parameter..?
    2)How do you get the information of hidden parameters
    3)What is the database object that stores information related to various types of db connections over network
    4)How do you verify since when the db session is running
    5)How do you verify the Originating machine details of the database session
    6)How do you verify the name of program that the db session is running
    7)What is the naming convenion of Base tables. Where is the information of base tables stored?
    8)How are dynamic views created. Whre is the information of dynamic views stored?
    Kindy tell me.
    Thanks,
    928714.

    928714 wrote:
    Hello,
    I need answers for few questions.It helps me a lot.It may be very basics but kindly answer me.
    )How do you view the value of the parameter that is being used by instance?
    show parameter..?* At sql prompt enter
    show parameter PARAMETER_NAME
    or you can use the query
    select name, value from v$parameter where name='PARAMETER_NAME';
    >
    2)How do you get the information of hidden parametersThe hidden parameters start with an "_".They can not be viewed from the output of 'show parameter'
    or querying v$parameter unless and until they are set explicitly in init.ora.
    Use the query (make sure you have connected as SYSDBA)
    SELECT a.ksppinm "Parameter",
    b.ksppstvl "Session Value",
    c.ksppstvl "Instance Value"
    FROM x$ksppi a,
    x$ksppcv b,
    x$ksppsv c
    WHERE a.indx = b.indx
    AND a.indx = c.indx
    AND a.ksppinm LIKE '/_%' escape '/'
    3)What is the database object that stores information related to various types of db connections over networkYou can query the view DBA_DB_LINKS
    4)How do you verify since when the db session is runningselect (sysdate-logon_time)*24*60 "SESSION running since(in mins)" from v$session
    5)How do you verify the Originating machine details of the database session
    6)How do you verify the name of program that the db session is runningFor point 5 and 6 use the following query:
    select program "PROGRAM" , machine "ORIGINATING MACHINE " from v$session
    7)What is the naming convenion of Base tables. Where is the information of base tables stored?For naming conventions refer following links
    http://www.oracle-base.com/articles/misc/naming-conventions.php
    http://ss64.com/ora/syntax-naming.html
    The information of Base tables is stored in the Data Dictionary
    8)How are dynamic views created. Whre is the information of dynamic views stored?Refer the follwoing link
    http://docs.oracle.com/cd/E11882_01/server.112/e10713/datadict.htm

  • @Ceroberts75-Need for Speed Questions !

    OK, This is in specific to Ceroberts75 and maybe also others... After People have reported some improvements in smoother and faster working of their N900 after the PR 1.3 update. The Need for speed Tips that Ceroberts75 has posted in his topic " Top 12 Maemo Issues and Fixes that Ceroberts" After the PR 1.3 update is it still required ?
    Following those tips for Need for speed, is it gonna make the device even more faster and smoother even after the PR 1.3 Update. is it still required after PR 1.3 update ?  

    ceroberts75 wrote:
    dont worry about it.  it is not going to hurt your device....
    but if you still feel like there is a little monster lurking around the corner that is going to get you, then when you uninstall the swappolube, it will automatically go back to stock settings.
    this is the same for the transition control.
    as for the speed and which one you should use....that kernel that you installed, enhanced kernel....  all the different speeds are fine. i have 2 units locked at 1.15ghz since it came out and prior to that, at 900mhz.  i have yet to see anything bad happen, ie-phone catching on fire or burning my face, or discoloring my elppa casing...oops...was that my outside typing fingers?  anyway...i would not have put it up there if  it wasnt safe to do so.
    have fun with it...you will not hurt your device doing so.
    Hey Ceroberts75,
    Sorry if I am asking you this again, But I am still not really satisfied. I am OK with Swappolube, But I want to delete this events.d.folder that it created when I accidentally also clicked on the store Tab (pls check the screenshot). How do I delete events.d.folder. I checked my entire phone I could not find it anywhere where has it gone and is hiding.
    I am ok with Swappolube but I don’t want the events.d.folder to store anything.
    is the events.d.folder associated with Swappolube? So if I uninstall swappolube will it also go away with swappolube !!
    Attachments:
    Swappolube.jpg ‏58 KB

  • NEED FOR INTERVIEW QUESTION SQL AND PL/SQL

    I am finished Oracle 9i OCA.Pls Anyone help me.Interview Questions for SQL and PL/SQL.

    Hi,
    first of all, It is not the right place for this question. Better Google it and you will find hell lot of information over there.
    Still, Give your email id, i will send you all the SQL/PLSQL interview question, I am having..
    Thanks
    KaMaL

  • Decode query need for aging

    Hi All,
    Following is the query which is working for aging for condition and round(st.close_dt - st.open_dt) >60 and corresponding column output count(round(st.close_dt - st.open_dt)) ">60" but we need the same in report of column of
    count(round(st.close_dt - st.open_dt)) "<15"
    count(round(st.close_dt - st.open_dt)) "16 to 30"
    count(round(st.close_dt - st.open_dt)) "31 to 45"
    count(round(st.close_dt - st.open_dt)) "45 to 60"
    which is based on condition round(st.close_dt - st.open_dt) <15
    round(st.close_dt - st.open_dt) between 16 and 31
    round(st.close_dt - st.open_dt) between 31 and 45
    round(st.close_dt - st.open_dt) between 46 and 60
    but we can't use this all condition at a time as individual it is working fine.
    Could you please let me know how we can user this all in one so the I can get the output at a time <15, 16 to 30, 31 to 45, 46 to 60 and >60.
    {select       count(round(st.close_dt - st.open_dt)) ">60"
      from stat.csr_master_tbl m,
         stat.customers c,
         stat.proj_csrs p,
         stat.appl_type ap,
        stat.csr_type_cd tp,
         stat.csr_status st,
         stat.csr_status_cd sc,
         stat.wrkflw_defn w
    where m.cust_id = c.cust_id
    and m.csr_id  = p.csr_id (+)
    and m.sd_cd  = p.sd_cd (+)
    and m.appl_cd = ap.appl_cd
    and m.sd_cd = ap.sd_cd
    and m.sd_cd = tp.sd_cd
    and m.csr_type = tp.csr_type_cd
    and m.sd_cd = st.sd_cd
    and m.csr_id = st.csr_id
    and st.csr_status_cd = sc.csr_status_cd
    and st.sd_cd = sc.sd_cd
    and tp.csr_type_cd = sc.csr_type_cd
    and m.wrkflw_id = w.wrkflw_id
    and (m.sd_cd in ('11i','AVA') or (m.sd_cd in ('STR') ))
    and (    st.close_dt between to_date(:beg_date,'MM/DD/YYYY') and to_date(:end_date,'MM/DD/YYYY')
           or st.closed_status_flag <> 'Y')
    --and sc.descr <> 'Cancel'
    AND sc.descr  IN ('Close')
    and p.proj_cd='OAPS'
    and round(st.close_dt - st.open_dt) >60
    and tp.descr in ('Break-Fix Datafix'
    ,'Break-Fix Configuration'
    ,'Break-Fix  Development'
    ,'Vendor Patch')
    and c.first_name in ('Springville'
    ,'Cookeville'
    ,'Bangalore'
    ,'Deer Park'
    ,'Sulphur Springs'
    ,'P11i'
    ,'Singapore'
    ,'Bangalore Chemical'
    ,'Baton Rouge'
    ,'Kaohsiung'
    ,'Bangalore Controls'
    ,'Damam'
    ,'Dayton Foundry'
    ,'Edmonton'
    ,'Jebel Ali'
    ,'Melbourne'
    ,'Philadelphia')}

    You might try something like
    select
       sum(case when round(st.close_dt - st.open_dt) < 15              then 1 else 0 end) "< 15",  -- shouldn't it be <=15?
       sum(case when round(st.close_dt - st.open_dt) between 16 and 30 then 1 else 0 end) "16 to 30",
       ...and you should have posted this question in the PL/SQL forum.
    Edited by: UW (Germany) on 17.08.2012 12:15

  • Query Needed for Partitioning table

    Hi,
    I have created a table called Test. There is a column named business_name.
    There are several businesses like ABC,BCD,ADE....
    There will be lakhs of rows corresponding to each business, i mean there will be lakhs of entires corresponding to ABC,BCD....
    So i like to partition the table according to business_name so that the search will be more faster.As we had partitioned according to the business_name, i hope we need to search only on the partition corresponding to the particular business.
    can any one provide the Query to partition the table ' TEST ' according to the column ' business_name ' .
    Also can anyone provide Query to modify the already existing table ' TEST ' to incorporate partition for the column ' business_name '.

    We can partiton a table by the following
    create table Generalledger (
         record_id     number,
         business_name     varchar2(3)
         sales_dt     date,
         amount     number(10)
    partition by list (business_name)
    partition ct values ('ABC'),
    partition ca values ('BCD'),
    partition def values (default)
    But if we dont know the values like 'ABC' , 'BCD'
    ....how can we do the partitionuse SQL to generate part (or all) of your DDL statement. The following will output one partition statement for each business_name:
    SELECT DISTINCT 'partition p_' || BUSINESS_NAME || ' values (''' ||
                     BUSINESS_NAME || '''),'
    FROM GENERALLEDGER;

  • QUERY NEED FOR TIME DIFFERENCE

    Hi
    I need a query to find the difference between time
    for example
    5.00 hours - 0.30 minutes = 4.30 hours
    Thanks in Advance
    Adina

    Is this what you are looking for -
    1  select to_date('05:00', 'hh24:mi') - 0.5/24   --Subtract ½ Hr from time
      2* from dual
    SQL> /
    TO_DATE('05:
    200804010430
      1  select to_date('05:00', 'hh24:mi') - 3/24     --Subtract 3 Hrs from time
      2* from dual
    SQL> /
    TO_DATE('05:
    200804010200
      1  select to_date('05:30', 'hh24:mi') + 0.5/24   --Adds ½ Hr to the time
      2* from dual
    SQL> /
    TO_DATE('05:
    200804010600
      1  select to_date('20080416 00:02', 'yyyymmdd hh24:mi') - 0.5/24     --Subtract ½ Hr from time  2* from dual
    SQL> /
    TO_DATE('200
    200804152332Shailender Mehta

  • Query needed for Cumulative data

    HI Friends,
    I need output like this.
    Frequency     Percent (%) Cumulative
    Frequency     Cumulative Percent
    4468     0.91     4468     0.91
    21092     4.31     25560     5.23
    57818     11.82     83378     17.05
    6274     1.28     89652     18.33
    I am using Oracle 9i.
    My output data like this and I need to write the query for 3 columns (Percent ,Cumulative frequency and Cumulative percent)
    1:The formula for Percent column data is (Frequency/Sum of cumulative frequency)*100
    2:The formula for Cumulative Frequency column data is (Cumulative of Frequency column data)
    3:The formula for Cumulative Percent column data is (Cumulative of Percent column data)
    What should be the analytic function and how to write the query.
    Thanks,
    Lony

    Hi Friends,
    I need output like this.
    Frequency Percent (%) Cumulative Frequency Cumulative Percent
    4468 0.91 4468 0.91
    21092 4.31 25560 5.23
    57818 11.82 83378 17.05
    6274 1.28 89652 18.33
    I am using Oracle 9i.
    My output data like this and I need to write the query for 3 columns (Percent ,Cumulative frequency and Cumulative percent)
    1:The formula for Frequency column data is sum of (dd+cc+mc_cc_mc).
    1:The formula for Percent column data is (Frequency/Sum of cumulative frequency)*100
    2:The formula for Cumulative Frequency column data is (Cumulative of Frequency column data)
    3:The formula for Cumulative Percent column data is (Cumulative of Percent column data)
    What should be the analytic function and how to write the query.Please find the sample data and table script.
    CREATE TABLE all_lony (
    campno varchar2(20),
    dd INTEGER,
    cc INTEGER,
    mc INTEGER,
    cc_mc INTEGER
    insert into all_lony (campno,dd,cc,mc,cc_mc)
    values(36,156,1320,445,2547);
    insert into all_lony (campno,dd,cc,mc,cc_mc)
    values(40,233,19711,263,885);
    =============
    Please find my query below
    SELECT campno
    || ','
    || dm
    || ','
    || cc
    || ','
    || mc
    || ','
    || cc_mc
    || ','
    || frequency
    || ','
    || per
    ||','
    ||cumulative_fr
    ||','
    || SUM (per) OVER (ORDER BY per ROWS UNBOUNDED PRECEDING)
    FROM (SELECT q3.campno campno, q3.dm, q3.cc, q3.mc, q3.cc_mc,
    q3.frequency, q3.cumulative_fr,
    (q3.Frequency / SUM (q3.cumulative_fr)) * 100 per
    FROM (SELECT q2.campno campno, SUM (q2.dm) dm, SUM (q2.cc) cc,
    SUM (q2.mc) mc, SUM (q2.cc_mc) cc_mc,
    (SUM ( NVL (q2.dm, 0)
    + NVL (q2.cc, 0)
    + NVL (q2.mc, 0)
    + NVL (q2.cc_mc, 0)
    ) frequency,
    SUM (SUM ( NVL (q2.dm, 0)
    + NVL (q2.cc, 0)
    + NVL (q2.mc, 0)
    + NVL (q2.cc_mc, 0)
    ) OVER (ORDER BY SUM ( NVL (q2.dm, 0)
    + NVL (q2.cc, 0)
    + NVL (q2.mc, 0)
    + NVL (q2.cc_mc,0)
    ) ROWS UNBOUNDED PRECEDING)
    cumulative_fr
    from all_lony
    q1 )q2
    GROUP BY q3.campno) q3
    GROUP BY campno, dm, cc, mc,cc_mc, frequency,cumulative_fr)
    Can anybody just verify the query and let me know.

  • Approval Query needed for AR Reserve Invoice

    Need to create an approval for delivery doc- If AR reserve invoice not paid need to triger an approval.  how can I cutomise the query to look at base document.
    SELECT DISTINCT  'TRUE' FROM OINV T0 WHERE T0.[isIns] = 'Y' AND  T0.[DocStatus] <> 'C'
    Thanks and Regards

    Hi Anoop,
    This one should do it I believe. I have attachde the query as not everything gets copied in this forum. The query below will not work.
    SELECT distinct 'true' FROM DLN1 T0 WHERE T0.[BaseType] = 13 and  $[$38.45.1] in (SELECT docentry  FROM OINV T0 WHERE isins = 'Y' and paidtodate <> doctotal)
    There are a few limitations with approvals in B1 that are based on values on the linelevel like this one.
    The query can not see past the first line of the document. So it will only check the basedoc of the first item in the Delivery (it is possible to add an item on the first line after copying the Reserve Invoice details into the delivery).
    Apart from that, the query only checks if the payment have been fully done "(paidtodate <> doctotal)", if it has been partially paid it will still trigger the approval. If partial payment is acceptable you can change that to "paidtodate <> 0".
    Hope it helps,
    Jesper

  • Query needed for projects??

    Hi ,
    Iam not aware of projects module,but i got a requirement to built a projects module related query in R12 module.
    My requirement is i need to built projects invoice query.All important columns like customer_name,project_number,
    agreement,task_no,task_types,quantity,uom,invoice_amount this is what they told.
    Please can any1 who have projects module knowledge,help me by building the query.
    Regards,
    Kranthi.

    Are you going to answer the question asked?... is it an Oracle Apps question? Then go to the Oracle Apps forum... the volunteers there have domain knowledge.. This is a "general" SQL and PL/SQL forum

  • Sql query need for date format''Mon 23 Apr 16:45 pm'

    i need SQL query to print date like 'Mon 23 Apr 16:45 pm' format

    SQL> select to_char(sysdate,'Dy fmddfm Mon hh24:mi pm','nls_date_language=american') from dual
      2  /
    TO_CHAR(SYSDATE,'DY
    Fri 27 Apr 13:04 pm
    1 rij is geselecteerd.Regards,
    Rob.

  • Query need for Joins

    ORD :
    ORD_ID
    ORD_DATE
    CUST_ID
    ORD_TOTAL
    CUST :
    CUST_ID
    CUST_NAME
    CITY
    QUEST:
    1. Irrespective of years write a query to find order which are placed between 15th and 31st of month september ?

    31st of month september ?Don't know who made up those interview questions, but september only has 30 days....
    SQL> select last_day(add_months(sysdate, -1)) from dual;
    LAST_DAY(ADD_MONTHS
    30-09-2010
    1 row selected.You can find information regarding the last_day and add_months functions and other DATE datatype related stuff by doing a search in the Docs @
    http://www.oracle.com/pls/db102/homepage
    http://www.oracle.com/pls/db112/homepage

  • Query need for transpose data output

    Dear All,
    I have a query regarding transpose output.
    for ex. I created one table employee in database
    create table emp(emp_no number,dept_id number(10));
    it is having data like....
    emp_no dept_id
    101 10
    102 20
    103 10
    104 10
    105 20
    so I want the output in transpose format like
    dept_id emp_no1 emp_no2 emp_no3
    10 101 103 104
    20 102 105
    can anybody suggest me any query for the above output.
    Thanks...
    Prashant....

    select dept_id
         , max (decode (emp_no, 101, emp_no))
         , max (decode (emp_no, 102, emp_no))
         , max (decode (emp_no, 103, emp_no))
         , max (decode (emp_no, 104, emp_no))
         , max (decode (emp_no, 105, emp_no))
      from test
    group by dept_idas in
    SQL> with test as
      2  (
      3  select 101 emp_no, 10 dept_id from dual union all
      4  select 102 emp_no, 20 dept_id from dual union all
      5  select 103 emp_no, 10 dept_id from dual union all
      6  select 104 emp_no, 10 dept_id from dual union all
      7  select 105 emp_no, 20 dept_id from dual
      8  )
      9  select dept_id
    10       , max (decode (emp_no, 101, emp_no)) emp1
    11       , max (decode (emp_no, 102, emp_no)) emp2
    12       , max (decode (emp_no, 103, emp_no)) emp3
    13       , max (decode (emp_no, 104, emp_no)) emp4
    14       , max (decode (emp_no, 105, emp_no)) emp5
    15    from test
    16   group by dept_id
    17  ;
       DEPT_ID       EMP1       EMP2       EMP3       EMP4       EMP5
            20                   102                              105
            10        101                   103        104

  • Query needed for the below requirement

    Hi,
    I have three tables structures like below.
    tableA - LINE_ID, VENDOR_ID,DEAL_SITE_ID
    tableB - LINE_ID, DEAL_SITE_ID
    tableC - DEAL_ID,VERSION, DEAL_SITE_ID
    Now the requirement is I have to fetch all distinct VENDOR_ID from tableA with some given DEAL_ID (100001) and VERSION (1), only Problem is in tableA the rows which have LINE_ID will not have DEAL_SITE_ID and vice versa. I've used the below query for this purpose but wanted to know if there is any better solution.
    select distinct VENDOR_ID from tableA where deal_site_id in
    (select deal_site_id from tableC where deal_id = 100001 and snapshot_ver = 1)
    UNION
    select distinct VENDOR_ID from tableA where line_id in
    (select line_id from tableB where deal_site_id in
    (select deal_site_id from tableC where deal_id = 100001 and snapshot_ver = 1))
    Regards,
    Subhadeep
    Edited by: sumajumd on Jul 17, 2012 2:33 AM

    Try regular joins (assuming column version should be snapshot_ver).
    Like this (untested):
    select tablea.vendor_id
    from   tablea
      inner join tablec on (tablea.deal_site_id = tablec.deal_site_id)
    where  tablec.deal_id      = 100001
    and    tablec.snapshot_ver = 1
    union
    select tablea.vendor_id
    from   tablea
      inner join tableb on (tableb.line_id      = tablea.line_id)
      inner join tablec on (tableb.deal_site_id = tablec.deal_site_id)
    where  tablec.deal_id      = 100001
    and    tablec.snapshot_ver = 1

Maybe you are looking for

  • Segmentation Tools with BW datasets

    Hello CRM Experts, In our business scenario we would like segment with contact people.  In our CRM 4.0 system we use the relationship tab within business partner master data to define the link to the respective contact people. The standard BW object

  • Internal table with variable no of columns

    Hi All, I have to create an internal table with some fixed columns and rest of the table should be dynamic. The total no of columns depends on a field of some other table. hence, the number of columns of the table are unknown. How to create such a ta

  • The XIr3 SharePoint Web Part for Webi is throwing errors to SharePoint.

    Hi Admin's, Have any of you seen this error... We've built an XIr3 environment to expose Webi via the PIK webpart to SharePoint as a reporting portal. The backend is Sql linked servers via an OLEDB provider from a vendor named OSI (PI historian). The

  • Css upgrades in CS3

    Hi All, About to redesign or company website. A lot of the site is complicated layouts, we ahve used tables in the past, and css with varying results. Is CS3 more usable / effective in dreamweaver, and do I need to upgrade fireworks to make it work b

  • Magic Mouse-Right click and left click reversed?

    Hello! Thanks in advance for any info you can provide regarding my problem. My wireless keyboard and magic mouse recently has been disconnecting from Bluetooth. A few days ago they both quit, and after a call to apple tech support, I tried everything