Column Compare in Query

Hi all
I have four tables test1, test2 ,test3 & test4
i have Unique Common columns in test1, test2 ,test3
but i dont have common Column in test1, test4
But i have Uniqe Common Column in test3 & test4
Can i Write the Sql Query as Follows
please Suggest Me
I am in a Urgent Need
select A.*,B.xyz1,
C.xyz2,
D.xyz3
from
TEST1 A,
TEST2 B,
TEST3 C,
TEST4 D
WHERE
A.reason=B.reason
and
(A.reason1=C.reason1 and C.reason2=D.reason2)
many thanks
Edited by: jrDba - atm on Jun 7, 2009 1:36 AM
Edited by: jrDba - atm on Jun 7, 2009 3:35 AM

I AM IN AN URGENT NEED1. Posting in upper case implies shouting. Don't shout, it won't get you any more (positive) attention.
2. Urgent implies that your need is greater than others. That is simply rude and, generally speaking, unnacceptable in forum nettiquette. Do a quick search on the word urgent in this forum and have a look at the kind of attention that it tends to get.
3. If you truly do have an urgent requiremnt, post a working test case i.e. create table and insert statements that will generate a set of data that represents the situation that you find yourself in. Also post expected results based on the sample data that you have supplied, along with a brief text description of your requirements. (Oh, and please try to use better names than Test1, test2 etc.)
Can i Write the Sql Query as FollowsWell, it's syntactically correct so, yes you can. However, since we have absolutely no idea what your requirements are, we can't say if it will give you what you need.

Similar Messages

  • New custom column in a query

    Hi experts,
    I am doing a query and I need to do something that I am not sure if it can be done. I have one characteristic (0COUNTRY) in the query and one variable to filter by Sales Organization. What I need to do is to have a new column in the query that will show ‘Local market’ in case 0COUNTRY is the same as the Sales Organization country attribute, and ‘Export market’ when it is different. Does anybody know if this can be done in BeX analyzer?
    Any hint would be appreciated.
    Thanks and regards,

    Hi,
    U can achieve this by using virtual characterstics.Add another characterstics in the cube with length 20 char (Say ZTEXT).
    Code in the exit RSR00002 with program ZXRSRU02 for virtual characterstics.
    Here u can put the logic as follows:
    Read value 0COUNTRY compare the value with SALESORG 0country attrtibute value  from master data table.
    if same ZTEXT = 'Local market’
    else.
               ZTEXT = 'Export market’
    There will be some performance issue but if the requirement like this u can try with this.
    Thanks,
    Debasish

  • Column Compare

    Hi all
    i wanted 2 retrive Data from Four tables,
    i have Common Column in 3 tables i.e, from TEST,TEST1, TEST2
    but I DONT HAVE COMMON COLUMN IN
    table TEST & TEST3,
    but i have Common Column in TEST2 & TEST3
    CAN I WRITE THE SQL query as Below
    select A.*,B.xyz1,
    C.xyz2,
    D.xyz3
    from
    TEST A,
    TEST1 B,
    TEST2 C,
    TEST3 D
    WHERE A.reason=B.reason
    and
    (A.reason1=C.reason1 and C.reason2=D.reason2)
    please Suggest
    many thanks

    Duplicate post Column Compare in Query

  • Multiple Key figure in a single column of a query

    Hi,
    Is it possible to use muliple key figure like Amount and Qty field together in a column of a query?
    Please advise,
    Best Regards,
    UR

    Hi,
    You will be able to do it with the help of cell definitions.
    Say,you have a structure in Rows :
    A
    B
    For A ..in corresponding column cell,use cell definition with KF1
    For B.....in corresponding column cell,use cell definition with KF2
    this way,you will be able to see both in one column
    I m not sure how much it is relavant to your requirement.But this is one way of gettin it

  • Comment column in a query

    Hello,
    In a BW query, I need to add a column of text comments (for example, the description of a calculation, the unit used, ...). These texts are static, the queries will only be used as static reports (download scheduler), in excel and web, so we can not use any VB script.
    Is it a way to add some text in a cell of a column, as in the following example (columns 2 and 3) ?
    KF1    |    Comment for KF1    |    Euros    |    12
    KF2    |    Comment for KF2    |    %          |    47
    Thanks in advance
    Michaë

    Hi guys,
    finally how you fix this problem?, I need to show a comment in a query column and i don't know if this is posible ¿?, I have a query inside of a wad and I want to show a comment in the columns  of the query with the formula details.
    Please let me know if you this is possible.
    Thanks!, Kinds Regards

  • Creating an empty column in a query

    Is there a way to place an empty column in  a query? I would like to put acolumn with no information into the middle of a query. The reason is that the information that goes in that column is not available on any tables in my SQL databases.
    SELECT
    hier.dir_name 
    ,hier.am_name 
    ,hier.fm_name     INSERT BLANK COLUMN HERE
    ,hier.tech_name
    hier.tech_id

    Hi
    "no information" in database is usually NULL value. Is this what you are looking for?
    SELECT
    hier.dir_name
    ,hier.am_name
    ,NULL as fm_name
    --,hier.fm_name INSERT BLANK COLUMN HERE
    ,hier.tech_name
    hier.tech_id
    [Personal Site] [Blog] [Facebook]

  • Access Summary column in a query

    Hi All,
    I am new to oracle reports. I am using report builder 10.1.2.0.2.
    I have a summary column in my report. I would like to use this summary column in another query.
    if is use this column directly in the query, i am getting the below error:
    "Field 'F1' references column '<summary column name>' at a frequency below its group. "
    Both these fields are in the same frame. In the object navigator, both are displayed under the same group name.
    please let me know if there any way to access summary columns in another query.
    Thanks.

    You can use a field from one query in another query as parameter, i.e. preceded by colon. To do this first create link of "Group to Query" type between the first query's group where the summary column is, and the second query.

  • Set Column width in query (not using SQL*Plus)

    How can I Set Column width in query
    I understand you can set column width using
    column col1 FORMAT A5
    select col1 from table1;But this only works in SQL*Plus
    I want to be able to do this in a regular SQL query window (not in SQL*Plus), how can I do it.....
    I am using a 'SQL window' in PL/SQL Developer IDE
    and when I use this syntax it says:
    ORA-00900: Invalid SQL statement
    Any suggestions are appreciated...
    thanks,
    M.

    Did you try using RPAD or LPAD functions? They fill the unfilled part of a string with character you provide... either on right or left side depending on what function you use.
    e.g.
    SELECT RPAD('Smith', 10, ' ') Name FROM dual;http://www.adp-gmbh.ch/ora/sql/rpad.html
    Edited by: Zaafran Ahmed on Nov 10, 2010 11:50 AM

  • Multiple columns from a query sorted vertically

    Is it possible to sort a query resultset vertically, with
    multiple columns across the page, in the following manner, with
    page breaks after 40 rows? I can get it to sort horizontally just
    fine with tables, but how can it be done vertically as shown?
    JONES, Abby JONES, Betty JONES, Dawn JONES, Frank
    JONES, Adam JONES, Bill JONES, Debbie JONES, Gayle
    JONES, Alice JONES, Bob JONES, Denton JONES, Henry
    JONES, Ben JONES, Cathy JONES, Emma JONES, John

    This will get you started. I assume you had the appropriate
    order by clause in your query. I also assume you want 4 columns per
    line.
    My approach would be to convert the query to an array and
    then output the array.
    columns = 4;
    maxrows = 40;
    recordsperpage = columns * rows;
    records = query.recordcount;
    myArray = ArrayNew(2);
    ThisColumn = 1;
    ThisRow = 1;
    if (records gt recordsperpage)
    LoopTill = recordsperpage;
    else
    LoopTill = records;
    for ( ii = 1; ii lte LoopTill; ii = ii + 1){
    myArray[ThisRow][ThisColumn] = query.field[ii];
    increment ThisRow;
    if (ThisRow = MaxRows + 1) {
    ThisRow = 1;
    increment ThisColumn;
    } // if
    } // looop
    You can do the rest

  • Sum of columns in union query

    hi, i am using oracle 10g database..
    how to get the sum of column in union query ?
         select * from (select 100 records from dual), (select 50 available from dual)
    union
    select * from (select 200 records from dual), (select 150 available from dual)
    display should be like
                     records         available
                      100               50
                      200               150
    total            300               200thanks ...

    Peter vd Zwan wrote:
    try this:Grouping by records will not produce correct results:
    SQL> with a as
      2  (
      3  select * from (select 100 records from dual), (select 50 available from dual)
      4  union
      5  select * from (select 100 records from dual), (select 100 available from dual)
      6  union
      7  select * from (select 200 records from dual), (select 150 available from dual)
      8  )
      9  select
    10    case when grouping(records) = 0 then null else 'total' end tot
    11    ,sum(records)   records
    12    ,sum(available) available
    13  from
    14    a
    15  group by
    16  rollup (records)
    17  ;
    TOT      RECORDS  AVAILABLE
                 200        150
                 200        150
    total        400        300
    SQL> select  case grouping(rownum)
      2     when 1 then 'Total'
      3   end display,
      4          sum(records) records,
      5          sum(available) available
      6    from  (
      7            select * from (select 100 records from dual), (select 50 available from dual)
      8           union
      9            select * from (select 100 records from dual), (select 100 available from dual)
    10           union
    11            select * from (select 200 records from dual), (select 150 available from dual)
    12          )
    13    group by rollup(rownum)
    14  /
    DISPL    RECORDS  AVAILABLE
                 100         50
                 100        100
                 200        150
    Total        400        300
    SQL> SY.

  • Retrieve varchar column from Oracle query in a resulset

    Hi, I'am a begginer in JSP Technologies.
    I've do a small jsp that opens a db connection to an oracle, execute a query a show results.
    When the columns of the query are int I've no problem, the jsp show the columns of the resulset, but when the columns selected are varchars the jsp doesn't show anything....
    Can anyone help me?
    Example:
    Table: CUSTOMERS
    Col1 : ID_COSTUMER int
    Col2: CUSTOMER_NAME varchar
    <%
    Connection canal = null;
    ResultSet tabla = null;
    Statement instruccion=null;
    try { Class.forName("oracle.jdbc.driver.OracleDriver");
    canal=DriverManager.getConnection("jdbc:oracle:thin:@XXXXXXXXXXXXXXXXXXXp");
    instruccion = canal.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    } catch(java.lang.ClassNotFoundException e){};
    String Query = "SELECT ID_CUSTOMER FROM CUSTOMERS";
    try { tabla = instruccion.executeQuery(Query);
    out.println("<TABLE Border=10 CellPadding=5><TR>");
    out.println("<TD>CUSTOMER</TD></TR>");
    while(tabla.next()) {
    out.println("<TR>");
    out.println("<TD>"+tabla.getString(1)+"</TD>");
    out.println("</TR>"); };
    out.println("</TABLE></CENTER></DIV></HTML>");
    tabla.close(); instruccion.close(); canal.close();}
    catch(SQLException e) {};
    %>Results:
    CUSTOMER
    1
    2
    3
    4
    Doing the change in query:
    SELECT CUSTOMER_NAME FROM CUSTOMERS
    I have not results....
    Thank you.

    sorry, I misplaced an ending code bracket on last one
    I'm not really familiar with doing this inside a jsp.. but there are a few things that you should try to make sure that it isn't a database problem before assuming it is a problem on your jsp.... It is possible you have already tried the following but just to make sure.
    When you do the second query does the first two out.printlns that are before the while still output? If not then your query is incorrect.
    Second I would try
    String Query = "SELECT ID_CUSTOMER,CUSTOMER_NAME FROM CUSTOMERS";
    try { tabla = instruccion.executeQuery(Query);
    out.println("<TABLE Border=10 CellPadding=5><TR>");
    out.println("<TD>CUSTOMER_ID</TD><TD>CUSTOMER_NAME</TD></TR>");
    while(tabla.next()) {
    out.println("<TR>");
    out.println("<TD>"+tabla.getString(1)+"</TD>");
    out.println("<TD>"+tabla.getString(2)+"</TD>");
    out.println("</TR>"); };
    out.println("</TABLE></CENTER></DIV></HTML>");I suspect this will also return nothing.. if that is the case then you need to check your database. If it does infact return values for the ID and nothing for the NAME then I'm not sure at this point what the problem is.

  • How Can i add "DateDiff(day, T0.DueDate" as a column in this query?

    How Can i add "DateDiff(day, T0.DueDate" as a column in this query?
    SELECT T1.CardCode, T1.CardName, T1.CreditLine, T0.RefDate, T0.Ref1 'Document Number',
          CASE  WHEN T0.TransType=13 THEN 'Invoice'
               WHEN T0.TransType=14 THEN 'Credit Note'
               WHEN T0.TransType=30 THEN 'Journal'
               WHEN T0.TransType=24 THEN 'Receipt'
               END AS 'Document Type',
          T0.DueDate, (T0.Debit- T0.Credit) 'Balance'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')<=-1),0) 'Future'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=0 and DateDiff(day, T0.DueDate,'[%1]')<=30),0) 'Current'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>30 and DateDiff(day, T0.DueDate,'[%1]')<=60),0) '31-60 Days'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>60 and DateDiff(day, T0.DueDate,'[%1]')<=90),0) '61-90 Days'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>90 and DateDiff(day, T0.DueDate,'[%1]')<=120),0) '91-120 Days'
          ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=121),0) '121+ Days'
    FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    WHERE (T0.MthDate IS NULL OR T0.MthDate > [%1]) AND T0.RefDate <= [%1] AND T1.CardType = 'C'
    ORDER BY T1.CardCode, T0.DueDate, T0.Ref1

    Hi,
    As you mentioned not possible to assign the dynamic column in the query.
    will give you example for generate a dynamic column name in SQL query, using this example you can achieve your requirement.
    DECLARE @cols AS NVARCHAR(MAX),
        @query  AS NVARCHAR(MAX)
    select @cols = STUFF((SELECT distinct ',' + QUOTENAME(C.Name) 
                        from [History]
                FOR XML PATH(''), TYPE
                ).value('.', 'NVARCHAR(MAX)')
            ,1,1,'')
    set @query = 'SELECT [Date],' + @cols +'
                 from
                    select [Date], Name, Value
                    from [History]
                 ) x
                pivot
                    max(value)
                    for Name in (' + @cols + ')
                ) p '
    execute(@query)

  • How to return Parameters values as a column in a query?

    Hi All,
    I have number of parameters in a report.
    I need to return its interred values as a column in a query to use this column in a chart.
    I want this column to be the second one in this query:
    SELECT ROWNUM
    FROM ALL_OBJECTS
    WHERE ROWNUM <= 10
    That is if there is any way to use these parameters directly as a column in the chart no need for the previous statement.
    Note: I am using Reports 6i

    Dear sir
    You can enter parameter as column in query like
    select :parameter p1, &hexadecima_paramataer p2, empcode
    from emps;
    that query make parameter as query column .
    &hexadecimal paramater can refer to database column of table emps
    and :paramater can refer to static string

  • How to implement 'Quick Select' column in a query result table?

    Hi,
    I have a requirement in OAF to design a search page with 'Quick select' column.
    One of the column in the query result table should be a quick select.
    Once user clicks on the quick select column, we have to navigate back to the previous page with the row value selected.
    Can anyone help me in this.
    Thanks.

    Also refer the search exercise in the toolbox tutorials.
    you can implement the quick search in the same way as update and delete buttons.
    --Prasanna                                                                                                                                                                                                                                                                                                                                   

  • Hide a column in BW Query

    Hi Gurus!
    I'd like to hide a column for specifics users in a BW Query.
    I flagged the InfoObject as Auth. Rel. and created an analysis authorization. I ran the query but I got "No authorization", when I checked the log I saw that the query is asking for full authorization value to that InfoObject. I tried with : (semi colon) value but I got the same result.
    Is there any way to hide a column in a query (with authorization concept) avoiding to redisign a new query?
    Thanks in advance.
    Best regards,
    Pepe

      when I checked the log I saw that the query is asking for full authorization value to that InfoObject
    Is there any way to hide a column in a query (with authorization concept) avoiding to redisign a new query?
    For your existing query, above two are conflicting. So guess you have to move with redesign/new query.
    Regards,
    Arpan Paik

Maybe you are looking for

  • My maestro debit is not working in Itunes as it is asking for an issue number but my card does not have one.

    I try to purchase a free app on the app store and it asks for my password. I put my password in and it asks me to change my billing info. I put in all the correct info but it asks for a issue number but my card does not have one so i can't purchase a

  • I would like to make firefox browser window much smaller.

    I think this would be so much easier but because I can't seem to shrink or decrease length of browser like I can the Google search window. When I pull it in it just increases length of Google browser window. There isn't room for my add-ons to show. I

  • MM Pricing procedure VS Tax procedure

    Hi Gurus, I have checked many  thread here , but still can not find the answer. Tax calculation procedure basically calculate the tax amount based on condition recaord maintained (dor tis corresponding Condition type). But we also can maintain Condit

  • ISE Guest Portal only redirect HTTPS traffic.

    I have a wireless deployment consisting of the following: 5760 WLC & ISE 1.2 Am I missing something here I have 4 similar deployments, and never had these issues: On Android / Apple devices, the guest portal does not pop up automatically & On a Windo

  • Mail in Lion

    Greetings, In Lion mail when you delete a message, the highlighted mail message goes back up to the previous message rather than down to the next message in the list.  For instance, if I have 5 email messages in my list and I skip the first message,