Results 1 to 3 of 3

Thread: Pl/sql

  1. #1
    Join Date
    Nov 2011
    Posts
    25

    Unanswered: Pl/sql

    I have a table(T1) contains multi records in a single column

    1,2,3
    10,11,12,14
    18,19,21,22
    31,34,35,36



    in another table(T2) I have records

    colA|colB
    1 | 15
    2 |16
    3 |17
    10 | 19
    11 |20
    12 |21
    14 | 26
    18 |27
    19 |28
    21 | 35
    22 |36
    23|37
    31 |77
    34 | 85
    35 |96
    36 |107
    how can i display colB in table T2 based on the input from T1.

    When the input from T1 is passed as 1,2,3 then it displays
    15 ,16,17
    When the input from T1 is passed as 18,19,21,22 then it displays
    27,28,35 36
    i am using Db2 database
    Do we need to use pl/sql or can be done using sql.
    Please provide a solution
    Last edited by pp8771; 04-05-17 at 02:18.

  2. #2
    Join Date
    Oct 2007
    Posts
    161
    Provided Answers: 9
    can be done using very simple SQL, think IN list. This forum is for helping you out with questions, not for doing a task for you. If you want someone to write it and test it for you, I am sure there are plenty on the board here that will let you deposit to their pay pal account.

    Dave

  3. #3
    Join Date
    Dec 2016
    Location
    New Hampshire, USA
    Posts
    1

    join tables

    You can also join the tables. The basic syntax would be something like

    select ...
    from T1,
    T2
    where T1.col1 = T2.colA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •