Solved

Two Table Data comparision

Posted on 2011-09-03
4
350 Views
Last Modified: 2012-08-14
Table I
==========
SL_NO      Phases
=========   ========
 6066      Phase I
6014      Phase II
6013      Phase III
6017      Phase IV
6016      Phase V



Table II
==========
SL_No      CALL_IN_NUMBER
=====          ================
1      606628347702
2      60177278738
3      601374244
4      60142444
5      60166621344
6      6066923847874



I am expecting that do a look up of Table II in Table in case pattern matches ex 1 row in table II matches with 1st row of table one hence Column C in table two to be filled with Phase I.
similarly 4th Row in Table II matches with row II in table I.


SL_No      CALL_IN_NUMBER      Col C
1      606628347702      Phase I
2      60177278738      Phase IV
3      601374244                            Phase III
4      60142444                            Phase II
5      60166621344      Phase V
6      6066923847874      Phase I


0
Comment
Question by:ratna1234
4 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 250 total points
ID: 36479537
select t2.sl_no, t2.call_in_number, t1. phases
from table1 t1, table2 t2
where table2.call_in_number like t1.sl_no || '%'

or, in ansi join syntax


select t2.sl_no, t2.call_in_number, t1. phases
from table1 t1 join table2 t2
on table2.call_in_number like t1.sl_no || '%'
0
 

Assisted Solution

by:arv_sab
arv_sab earned 250 total points
ID: 36486873
try


select SL_NO, CALL_IN_NUMBER, Phases Col C
from Table I, Table II
where substr(table II.CALL_IN_NUMBER,1,4)=Table I.SL_NO
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36929486
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now