Joining multiple column.

Hi,
Is there any way we can join multiple column even without a common key values does not have common values. for example, if i have 3 table t1, t2 and t3. all of these tables containts a common column name test, but does not contain the column values. Now, I need to fetch values from these 3 tables and at the same
time, the values shouldn't be duplicate.
hare krishna
Alok

Thanks Dave and Satyaki, but yet to find a solution, Anyways, I am posting here a
query and result set. may be, this would make more sence
SQL> select p.address1 , n.phone_number , s.resort
2 from profile_info p, name_phone_view n, stay_record_summary s
3 where p.name_id= n.name_id
4 and n.name_id = s.name_id
5 and rownum < 10 ;
ADDRESS1 PHONE_NUMB RESORT
7 Sham Nath Marg 23890500 TORJP
138,Residency Road 0116426753 AMAG
138,Residency Road 0116426753 AMAG
138,Residency Road 0116426753 AMAG
138,Residency Road 0116426753 TOBBR
138,Residency Road 0116426753 TOBL
138,Residency Road 0116426753 TOBL
138,Residency Road 0116426753 TOBL
138,Residency Road 0116426753 TOBL
here, you can clearly see that I am getting the duplicate values, which I don't need
though, I've used name_id column to join all of them. I know name_id doesn't hold the unique values, this is because I am getting these dup values. That's why, i asked you that is there any workaround to achive the desired.
hare krishna
Alok

Similar Messages

  • OUTER JOIN MULTIPLE COLUMNS

    Does anybody knows, if it's possible make an Outer Join in a
    concatenad columns ?
    I need to do the follow:
    To join two tables, where this tables are linked by three
    columns.
    I'm trying do it:
    select b.*
    from first a,second b
    where a.one||a.two||a.three = b.one||b.two||b.three(+)
    If somebody could help me, thanks in advanced.

    Does anybody knows, if it's possible make an Outer Join in a
    concatenad columns ?
    I need to do the follow:
    To join two tables, where this tables are linked by three
    columns.
    I'm trying do it:
    select b.*
    from first a,second b
    where a.one||a.two||a.three = b.one||b.two||b.three(+)
    If somebody could help me, thanks in advanced.Is there any reason why you are concatenating the columns
    together? This will prevent use of an index.
    Try the following:
    select b.*
    from first a, second b
    where a.one = b.one (+)
    and a.two = b.two (+)
    and a.three = b.three (+)
    Regards.
    Paul

  • Best approach to join multiple statistics tables into one

    I have read different approaches to join multiple statistics tables into one, they all have a column "productobjectid".
    I want to get all data for each product and put it to excel and output a jpg statistic with cfchart.
    How would you do this, the sql part?
    Thanks.

    A couple suggestions:
    1) when joining tables, its best to list both table/fields that you are joining in the FROM clause:
    FROM shopproductbehaviour_views INNER JOIN shopproductbehaviour_sails ON shopproductbehaviour_views.productobjectid = shopproductbehaviour_sails.productobjectid
    2) You add tables to a SQL join by placing another join statement after the SQL above:
    SELECT *
    FROM TableA INNER JOIN TableB on TableA.myField = TableB.myField
    INNER JOIN TableC on TableA.anotherField = TableC.anotherField
    3) If you have columns in the tables that are named the same, you can use column aliases to change the way they appear in your record set:
    SELECT TableA.datetimecreated 'tablea_create_date', TableB.datetimecreated 'tableb_create_date'
    4) Certainly not a requirement, but you might want to look into using <cfqueryparam> in your where clause:
    WHERE shopproductbehaviour_sails.productobjectid = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#all.productobjectid#">
     You might want to consider checking out one of the many tutorials on SQL available online.  Many of the questions you posed in your post are covered in pretty much every basic SQL tutorial.  Alternately, a good SQL book is worth its weight in gold for a beginning web applications developer.

  • Checking multiple columns using "IN"

    I have a query
    select 1 from tableA
    where
    cond1 = val1 and
    exists
    ( col1, col2, col3, col4 ) IN
    ( select
         cola, colb, colc, cold
    from
         table B
    where
         cond1 = val1
    Will this condition Checking for multiple columns in the IN work ?
    I actually mispelled a column name ( say colb ) in the sub query but it did not give a error, but executed fine by matching part of the columns alone?

    The execution plans look strangely similar.
    SQL> CREATE TABLE t1 (c1 INT NOT NULL, c2 INT NOT NULL, c3 INT NOT NULL);
    Table created.
    SQL> INSERT INTO t1 (c1,c2,c3)
      2  SELECT dbms_random.value(0,9)
      3       , dbms_random.value(0,99)
      4       , dbms_random.value(0,999)
      5  FROM   dual CONNECT BY LEVEL <= 10000;
    10000 rows created.
    SQL> CREATE TABLE t2 AS SELECT * FROM t1 SAMPLE BLOCK(10);
    Table created.
    SQL> BEGIN
      2      DBMS_STATS.GATHER_TABLE_STATS(user,'T1');
      3      DBMS_STATS.GATHER_TABLE_STATS(user,'T2');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t1 WHERE (c1,c2,c3) IN
      2         ( SELECT c1,c2,c3 FROM t2 )
      3 
    SQL> @xplan
    Plan hash value: 1275841967
    | Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |      |     1 |    18 |    12   (9)| 00:00:01 |
    |*  1 |  HASH JOIN RIGHT SEMI|      |     1 |    18 |    12   (9)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL  | T2   |   209 |  1881 |     3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL  | T1   | 10000 | 90000 |     8   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("C1"="C1" AND "C2"="C2" AND "C3"="C3")
    SQL> SELECT * FROM t1 WHERE EXISTS
      2         ( SELECT NULL FROM t2
      3           WHERE  c1 = t1.c1                   
      4           AND    c2 = t1.c2
      5           AND    c3 = t1.c3 )
      6 
    SQL> @xplan
    Plan hash value: 1275841967
    | Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |      |     1 |    18 |    12   (9)| 00:00:01 |
    |*  1 |  HASH JOIN RIGHT SEMI|      |     1 |    18 |    12   (9)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL  | T2   |   209 |  1881 |     3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL  | T1   | 10000 | 90000 |     8   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("C1"="T1"."C1" AND "C2"="T1"."C2" AND "C3"="T1"."C3")
    SQL>

  • Forming generic sql query   for joining multiple sap tables in ABAp

    Hi,
    I am new to this abap field ,facing an issue onsap-jco project . I have used RFC_READ_TABLE  FM ,Customized this FM but facing an issue how to write generic  open SQl select statement  for joining multiple tables  using RFC_READ_TABLE .Kindly help on this issue.
    Thanks.

    something like this? If your tuples are not single columns, then you'll have to use dynamic sql to achieve the same result.with
    table_1 as
    (select '|Xyz|Abc|Def|' tuple from dual
    table_2 as
    (select '|Data1|Data21|Data31|Data41|Data51|' tuple from dual union all
    select '|Data2|Data22|Data32|Data42|Data52|' tuple from dual union all
    select '|Data3|Data23|Data33|Data43|Data53|' tuple from dual union all
    select '|Data4|Data24|Data34|Data44|Data54|' tuple from dual union all
    select '|Data5|Data25|Data35|Data45|Data55|' tuple from dual
    select case the_row when 1
                        then tuple
                        else '|---|---|' || substr(tuple,instr(tuple,'|',1,3) + 1)
           end tuple
      from (select substr(a.tuple,instr(a.tuple,'|',:one_one),instr(a.tuple,'|',:one_one + 1)) ||
                   substr(a.tuple,instr(a.tuple,'|',1,:one_two) + 1,instr(a.tuple,'|',1,:one_two + 1) - instr(a.tuple,'|',1,:one_two)) ||
                   substr(b.tuple,instr(b.tuple,'|',1,:two_one) + 1,instr(b.tuple,'|',1,:two_one + 1) - instr(b.tuple,'|',1,:two_one)) ||
                   substr(b.tuple,instr(b.tuple,'|',1,:two_two) + 1,instr(b.tuple,'|',1,:two_two + 1) - instr(b.tuple,'|',1,:two_two)) tuple,
                   rownum the_row
              from table_1 a,table_2 b
    order by the_rowRegards
    Etbin
    Message was edited by:Etbin
    user596003

  • Merge/Concat Multiple Columns in a Flat-File wthin ODI

    Hi,
    I was wondering if there is a quick way to merge/concat multiple columns in a Flat-File from within ODI, a functionality kinda similar to Essbase load rule files for join/split columns etc.
    Please let me know.
    Thanks

    Looks like the CONCAT function works only with Memory Engine. Could someone please confirm this? If this is true, I guess applying the patch is the only resolution.
    Thanks

  • JoinRowSet : Multiple Columns as the MatchColumn

    Hi All,
    RE: JoinRowSet : Multiple Columns as the MatchColumn
    I spent one day and have been trying to join two tables with two columns as a JOIN match... cannot made anything work. I read all the doc and the JDBC RowSet Implementations Tutorial doesn't really help a lot.
    Any example will be appreciated.
    Connection con = DriverManager.getConnection(dbUrl,dbUserId,dbPasswd);
    Statement stmt8 = con.createStatement();
    ResultSet rs = stmt8.executeQuery("select project_id, bld_id, bld_name from table1");
    Statement stmt10 = con.createStatement();
    ResultSet rs3 = stmt10.executeQuery("select project_id, bld_id, project_name from table2");
    CachedRowSet crs3 = new CachedRowSetImpl();
    crs3.populate( rs);
    System.out.println("Size of the first cached rowset is:: "+crs3.size());
    CachedRowSet crs4 = new CachedRowSetImpl();
    rs.beforeFirst();
    crs4.populate( rs);
    System.out.println("Size of the first cached rowset is:: "+crs4.size());
    JoinRowSet jrs = new JoinRowSetImpl();
    System.out.println("Adding 1st crs :: "+crs3.size());
    int [] idArray = {1,2};
    crs3.setMatchColumn(idArray);
    jrs.addRowSet(crs3);
    crs4.setMatchColumn(idArray);
    jrs.addRowSet(crs4);
         FileWriter fWriter;
    fWriter = new FileWriter("myoutput.xml");
    jrs.writeXml(fWriter);
    fWriter.flush();
    fWriter.close();

    I have no idea this is what you are trying but look at this.
    String select Statement = "select table1.project_id, table1.bld_id, table1.bld_name, table2.project_name from table1 left join table2 on table1.project_id = table2.project_id and table1.bld_id = table2.bld_id where ... order ...";
    Statement stmt8 = con.createStatement();
    ResultSet rs = stmt8.executeQuery(select Statement );The joined data is in rs.
    rykk

  • How to join multiple tables !

    Give me the Example to join multiple tables 1

    Inner join
    IF p_bsart IS INITIAL.
    SELECT ekko~bukrs
    ekko~lifnr
    ekko~ebeln
    ekko~waers
    ekko~bsart
    ekko~ekorg
    ekko~ekgrp
    ekpo~ebelp
    ekpo~txz01
    ekpo~matnr
    ekpo~werks
    ekpo~menge
    ekpo~meins
    ekpo~netpr
    ekpo~netwr
    INTO TABLE t_itab1 FROM
    ekko INNER JOIN ekpo ON ekkoebeln = ekpoebeln
    WHERE ekko~ebeln IN s_ebeln AND
    ekko~bukrs IN s_bukrs AND
    ekko~lifnr IN s_lifnr AND
    ekko~ekorg IN s_ekorg AND
    ekko~ekgrp IN s_ekgrp AND
    ekpo~matnr IN s_matnr.
    The difference between an INNER JOIN and an OUTER JOIN is the following. If a query on an INNER JOIN of VBAK (outer table) and VBAP (inner table) finds a record in VBAK but no matching records in VBAP, then no data is retrieved from the database because the inner table is empty. If you still want to keep VBAK rows for which there are no matching VBAP rows, you need to use the OUTER JOIN construct available in ABAP/4 Open SQL in 4.x..
    Hi
    Syntax
    ... [(] {dbtab_left [AS tabalias_left]} | join
    {[INNER] JOIN}|{LEFT [OUTER] JOIN}
    {dbtab_right [AS tabalias_right] ON join_cond} [)] ... .
    Effect
    The join syntax represents a recursively nestable join expression. A join expression consists of a left-hand and a right- hand side, which are joined either by means of [INNER] JOIN or LEFT [OUTER] JOIN . Depending on the type of join, a join expression can be either an inner ( INNER) or an outer (LEFT OUTER) join. Every join expression can be enclosed in round brackets. If a join expression is used, the SELECT command circumvents SAP buffering.
    On the left-hand side, either a single database table, a view dbtab_left, or a join expression join can be specified. On the right-hand side, a single database table or a view dbtab_right as well as join conditions join_cond can be specified after ON. In this way, a maximum of 24 join expressions that join 25 database tables or views with each other can be specified after FROM.
    AS can be used to specify an alternative table name tabalias for each of the specified database table names or for every view. A database table or a view can occur multiple times within a join expression and, in this case, have various alternative names.
    The syntax of the join conditions join_cond is the same as that of the sql_cond conditions after the addition WHERE, with the following differences:
    At least one comparison must be specified after ON.
    Individual comparisons may be joined using AND only.
    All comparisons must contain a column in the database table or the view dbtab_right on the right-hand side as an operand.
    The following language elements may not be used: BETWEEN, LIKE, IN.
    No sub-queries may be used.
    For outer joins, only equality comparisons (=, EQ) are possible.
    If an outer join occurs after FROM, the join condition of every join expression must contain at least one comparison between columns on the left-hand and the right-hand side.
    In outer joins, all comparisons that contain columns as operands in the database table or the view dbtab_right on the right-hand side must be specified in the corresponding join condition. In the WHERE condition of the same SELECT command, these columns are not allowed as operands.
    Resulting set for inner join
    The inner join joins the columns of every selected line on the left- hand side with the columns of all lines on the right-hand side that jointly fulfil the join_cond condition. A line in the resulting set is created for every such line on the right-hand side. The content of the column on the left-hand side may be duplicated in this case. If none of the lines on the right-hand side fulfils the join_cond condition, no line is created in the resulting set.
    Resulting set for outer join
    The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values.
    Example
    Join the columns carrname, connid, fldate of the database tables scarr, spfli and sflight by means of two inner joins. A list is created of the flights from p_cityfr to p_cityto. Alternative names are used for every table.
    PARAMETERS: p_cityfr TYPE spfli-cityfrom,
    p_cityto TYPE spfli-cityto.
    DATA: BEGIN OF wa,
    fldate TYPE sflight-fldate,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa.
    DATA itab LIKE SORTED TABLE OF wa
    WITH UNIQUE KEY fldate carrname connid.
    SELECT ccarrname pconnid f~fldate
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM ( ( scarr AS c
    INNER JOIN spfli AS p ON pcarrid = ccarrid
    AND p~cityfrom = p_cityfr
    AND p~cityto = p_cityto )
    INNER JOIN sflight AS f ON fcarrid = pcarrid
    AND fconnid = pconnid ).
    LOOP AT itab INTO wa.
    WRITE: / wa-fldate, wa-carrname, wa-connid.
    ENDLOOP.
    Example
    Join the columns carrid, carrname and connid of the database tables scarr and spfli using an outer join. The column connid is set to the null value for all flights that do not fly from p_cityfr. This null value is then converted to the appropriate initial value when it is transferred to the assigned data object. The LOOP returns all airlines that do not fly from p_cityfr.
    PARAMETERS p_cityfr TYPE spfli-cityfrom.
    DATA: BEGIN OF wa,
    carrid TYPE scarr-carrid,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa,
    itab LIKE SORTED TABLE OF wa
    WITH NON-UNIQUE KEY carrid.
    SELECT scarrid scarrname p~connid
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM scarr AS s
    LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid
    AND p~cityfrom = p_cityfr.
    LOOP AT itab INTO wa.
    IF wa-connid = '0000'.
    WRITE: / wa-carrid, wa-carrname.
    ENDIF.
    ENDLOOP.

  • Return multiple columns from an analytic function with a window

    Hello,
    Is it possible to obtain multiple columns from an analytic function with a window?
    I have a table with 4 columns, an id, a test id, a date, and the result of a test. I'm using an analytic function to obtain, for each row, the current test value, and the maximum test value in the next 2 days like so:
    select
    id,
    test_id,
    date,
    result,
    MAX ( result ) over ( partition BY id, test_id order by date RANGE BETWEEN CURRENT ROW AND INTERVAL '2' DAY FOLLOWING ) AS max_result_next_two_day
    from table
    This is working fine, but I would like to also obtain the date when the max result occurs. I can see that this would be possible using a self join, but I'd like to know if there is a better way? I cannot use the FIRST_VALUE aggregate function and order by result, because the window function needs to be ordered by the date.
    It would be a great help if you could provide any pointers/suggestions.
    Thanks,
    Dan
    http://danieljamesscott.org

    Assuming RESULT is a positive integer that has a maximum width of, say 10,
    and assuming date has no time-component:
    select
       id
      ,test_id
      ,date
      ,result
      ,to_number(substr(max_result_with_date,1,10)) as max_result_next_two_day
      ,to_date(substr(max_result_with_date,11),'YYYYMMDD') as date_where_max_result_occurs
    from (select
            id
           ,test_id
           ,date
           ,result
           ,MAX(lpad(to_char(result),10,'0')||to_char(date,'YYYYMMDD'))
               over (partition BY id, test_id
                     order by date
                     RANGE BETWEEN CURRENT ROW AND INTERVAL '2' DAY FOLLOWING )
            AS max_result_with_date
          from table)

  • Converting multiple column in single column

    Hi All,
    I need to create a table with single column by using select statement with multiple columns
    For Ex- i have 1 row with 10 columns (may be more than 10) like
    'A','B','C','D','E','F','G','H',I','J'
    i written sql like
    select 'A','B','C','D','E','F','G','H','I','J' from dual
    result is - 'A','B','C','D','E','F','G','H','I','J' with 10 columns
    Now i need output lik this using SQL
    Text
    'A'
    'B'
    'C'
    'D'
    'E'
    'F'
    'G'
    'H'
    'I'
    'J'
    Please help me to sort out this problem. Your help would highly appropriated.
    Regards
    Raju
    Edited by: 888667 on Apr 8, 2013 10:54 PM
    Edited by: 888667 on Apr 8, 2013 10:56 PM

    Welcome to the forum!!! You can convert column to row like this
    SQL>with my_table
      2  as
      3  (
      4  select 'A' col1,'B' col2,'C' col3,'D' col4,'E' col5,'F' col6,'G' col7,'H' col8,'I' col9,'J' col10
      5    from dual
      6  )
      7  select decode(no , 1, col1, 2, col2, 3, col3, 4, col4, 5, col5, 6, col6, 7, col7, 8, col8, 9, col9, 10, col10) col
      8    from my_table
      9    cross join (select level no from dual connect by level <= 10)
    10  /
    C
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    10 rows selected.
    SQL> To ask question in a better way please read {message:id=9360002} from FAQ

  • Converting multiple columns into one.

    All,
    I have a requirement to convert multiple columns into one. Following is the pseudo code of current implementation. It unions the various columns ( col1, col2........) into a new column new_col. But perforamnce is extrmely slow owing to multiple unions. It may be noted that tables and where conditions of all these queries are same.
    Can you help me create a more efficient query?
    select col1 , col2, col3, col4 from my_tables where some_cols = my_condition;Below is the query used to convert these columns into one.
    select col1 new_col from my_tables where some_cols = my_condition
    union all
    select col2 from my_tables where some_cols = my_condition
    union all
    select col3 from my_tables where some_cols = my_condition
    union all
    select col4 from my_tables where some_cols = my_condition

    Without looking at those things you could be barking up the wrong tree by assuming the issue relates to the unioning of queries or other such things.Well, might be.........
    Execution time of this query (just the execution time not the retrival) is around 34 seconds with connect-by clause for returning 22,000 records.
    Here's the plan
    Execution Plan
    | Id  | Operation                          | Name                        | Rows
    | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT                   |                             |   326
    | 33904 |   135   (2)|
    |   1 |  SORT ORDER BY                     |                             |   326
    | 33904 |   135   (2)|
    |   2 |   MAT_VIEW ACCESS BY INDEX ROWID   | MV_COMQ_RM_DEAL             |     1
    |    62 |     1   (0)|
    |   3 |    NESTED LOOPS                    |                             |   326
    | 33904 |   134   (1)|
    |   4 |     MERGE JOIN CARTESIAN           |                             |   326
    | 13692 |     3   (0)|
    |   5 |      VIEW                          |                             |     1
    |    13 |     2   (0)|
    |   6 |       COUNT                        |                             |
    |       |            |
    |   7 |        CONNECT BY WITHOUT FILTERING|                             |
    |       |            |
    |   8 |         FAST DUAL                  |                             |     1
    |       |     2   (0)|
    |   9 |      BUFFER SORT                   |                             |   326
    |  9454 |     3   (0)|
    |  10 |       TABLE ACCESS BY INDEX ROWID  | SF_SEARCH_IDS_TMP_COMQ      |   326
    |  9454 |     1   (0)|
    |  11 |        INDEX RANGE SCAN            | IDX1_SF_SEARCH_IDS_TMP_COMQ |   349
    |       |     1   (0)|
    |  12 |     INDEX RANGE SCAN               | IDX_MV_COMQ_RM_DEAL         |     9
    |       |     1   (0)|
    -----------------------     Hope, It's readable.......
    I would have posted sample data and query but........I cant do that...:(

  • JDBC, SQL-SELECT: Aliases for multiple columns?

    Folks;
    using SQL, JDBC with MaxDB 7.6, I am used to doing something like
    SELECT A AS FOO_A, B AS FOO_B, C AS BAR_C FROM FOO, BAR WHERE ...
    in order to make table columns have names sometimes more "meaningful" than in the actual database scheme. In a give environment, I will have to do a
    SELECT * FROM FOO,BAR WHERE ...
    with the difficulty that FOO and BAR contain columns of the same name, yet they both contain too many columns to actually enumerate/alias each one of them manually. Playing around trying something like
    SELECT FOO.* AS FOO_*, BAR.* AS BAR_* FROM FOO,BAR WHERE ...
    of course didn't work, and browsing the web I found there is no "standard SQL" way of doing something like this. Using
    java.sql.ResultSet
    provides a
    getMetaData()
    method which allows for determining the "table name" for a given column in the fetched result set, but unfortunately, the outcome returned by this method always seems to be empty. So to ask:
    - Is there any way in MaxDB-SQL to allow for "aliasing multiple columns"?
    - Alternatively, is there a way to make an SQL query joining multiple tables in MaxDB issued through JDBC generally return table columns in a <tablename>.<columnname> rather than just <columnname> style?
    Thanks a bunch in advance, best regards.
    Kristian

    HI Kristian,
    afaik the resultset.getMetaData() method should provide a MetaData-object that in turn implements methods like getColumnCount() or getColumnName() etc...
    Can you provide a piece of code to demonstrate that this is not working?
    I just tested DB Studio and Squirrel SQL (both use JDBC to connect to the database) and both are able to correctly figure out the structure of the result set for a query like yours.
    Anyhow, the whole requirement is not supposed to be supported.
    In fact, it's already a kind of 'glitch' that results with non-unique columnnames are actually produced, since relational theory forbids such results.
    That's also the reason for why you cannot further work with such a resultset (e.g. use it in a join).
    Therefore, no workaround in place here.
    If you´re going to have a query like this rather often, you may think about using views and define the aliases there only once.
    And besides all this, if you've got many duplicate column names it might also be a unlucky data design.
    best regards,
    Lars

  • Comparison of multiple column values with a single column value

    I have two separate tables say Tab1 and Tab2
    I want to select some datas , which is common to both the tables.
    In tab1 , there is a column 'STATE' and it's value is 'A'
    In tab2, there are multiple columns for the state, say STATE_A,STATE_B, STATE_C ETC and a row is present with the following details
    STATE_A = 1, STATE_B =1 ,STATE_C =0,STATE_D=1
    I need to select STATE when STATE_A ='1',
    if my STATE='B', this STATE has to be selected since STATE_B =' 1', similraly
    if my STATE='D', this STATE has to be selected since STATE_D =' 1',
    If my STATE='C', STATE_C should not get selected since it's '0'.
    Is it possible to do this in a single SELECT statement, where I have some other checks also or else how can I achieve it?

    Maybe this will help
    Select * from STATE_MAS ;
    STATE
    A
    B
    D
    F
    H
    Select * from STATE_CHILD
      STATE_A   STATE_B   STATE_C   STATE_D   STATE_E   STATE_F   STATE_G   STATE_H   STATE_I   STATE_J
            1         0         0         1         1         0         0         0         0         0
    CREATE OR REPLACE FUNCTION GET_STATE (P_VAL VARCHAR) RETURN NUMBER IS
    V_SQL VARCHAR2(200);
    V_COL VARCHAR2(35);
    P_RETURN NUMBER ;
    BEGIN
    V_COL := 'STATE_'||P_VAL;
    V_SQL := 'SELECT 1 FROM STATE_CHILD WHERE '||V_COL||' = 1 ';
    EXECUTE IMMEDIATE  V_SQL INTO P_RETURN ;
    RETURN P_RETURN ;
    END;
    SELECT STATE FROM STATE_MAS
    WHERE GET_STATE(STATE) = 1 ;
    STATE
    A
    D

  • JTextAreaCellRenderer to wrap text in multiple columns... any better way?

    I would like to use a basic JTextArea cell renderer to wrap the text in a JTable cell, like in this thread
    http://forum.java.sun.com/thread.jspa?threadID=664671&messageID=3893724
    Although the technique works, a disadvantage is that it cannot be used "as is" for multiple columns due to the setRowHeight/revalidate issue. One suggested workaround was to keep track of the maximum row height, as described here:
    http://www.javaspecialists.co.za/archive/newsletter.do?issue=106
    Both seem a bit rough. Are there any other options or more efficient techniques for automatically wrapping text in a JTable cell?

    Hello, did you search online? there are many tutorials like this one: http://www.photoshopessentials.com/photoshop-text/text-effects/text-wrap/
    You simply create a path, substract the parts you do not need, then click with the text tool inside.
    Note that it is not a dynamic text wrap, you need to change it if you move the objects around.

  • How to link Excel Chart with multiple columns dynamically?

    Hi all,
    I have one problem. I have an excel chart which has to read data from multiple columns for it's X-axis values (time stamps) and the same number of values for it's Y-axis from multiple columns. See figure attached.
    Now, you can do this by manually assigning values by holding control key to tell the chart that data from many columns is continued from the first column. i.e, a long data is distributed along may columns. This is done very easily manually.
    Now, how to do it at runtime through LabVIEW 8.0?
    Although, I have done it through labview when there where only two columns, A and B streching up to any length. But, now to save space we are dumping into many columns in the same page and want the chart plot that data as we dump it. 
    It is tough since I don't know how to assign SourceData of the chart through labview.
    I have attached chart's SourceData picture.
    Hope you all can solve my problem.
    The Y-axis values are: =(good!$B$30:$B$70,good!$D$30:$D$70,good!$F$30:$F$70,good!$H$30:$H$70,good!$B$71:$B$140,good!$D$71:$D$140,good!$F$71:$F$140,good!$H$71:$H$140,good!$B$141:$B$189)
    good is the name of the file.
    The X- axis values are: =(good!$A$30:$A$70,good!$C$30:$C$70,good!$E$30:$E$70,good!$G$30:$G$70,good!$A$71:$A$140,good!$C$71:$C$140,good!$E$71:$E$140,good!$G$71:$G$140,good!$A$141:$A$189)
    See the columns vary from A to F.
    I have still not got what I love.....
    Attachments:
    ExcelChart.JPG ‏113 KB
    SourceData.JPG ‏34 KB
    XY values.JPG ‏36 KB

    Ok i solved the excel chart problem. Here is the figure showing my victory! But offcourse with NI forum help.
    Message Edited by Halemani on 09-19-2008 06:33 AM
    I have still not got what I love.....
    Attachments:
    Chart_XValues_Values.JPG ‏36 KB

Maybe you are looking for

  • Export Voice Memos from iPhone 4 to Mac/itunes

    I'm trying to get Voice Memos from my iPhone 4 onto my computer so I can then subsequently put them on my iPhone 6. They didn't sync properly the first time I tried. The apple support told me that I would have to use third party software. Anyone know

  • Consistency error:more fields found in XML structure than specified in conv

    Hi, I am doing a File 0 RFC- File in PI 7.1 and facing the following error: 2009-12-07 09:45:05 Error        MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: Exception in XML P

  • RFC-JDBC synch, BPM or not?

    Hi everyone, I have a question regarding my business scenario. My scenario seems simple. RFC -> PI -> JDBC The RFC call is synchronous. When the data comes from the RFC PI will execute a stored procedure using JDBC. The stored procedure doesn't retur

  • Why does different software sound different¿

    Not that I care that much I'm just wondering why? I did a test, with the same exact .wav file in 3 different applications, I tested: Audition 3.0, Tracktion 2.0.2.14, Ableton Live 6, and they all sounded noticably different with settings on flat, exa

  • Coping photo to DVD

    How do you copy photos to a dvd? I have to reinstall my OS and my external hard drive that I usually back up to is not being recognized by my eMac.