Solved

Two Table Data comparision

Posted on 2011-09-03
4
351 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

920 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

12 Experts available now in Live!

Get 1:1 Help Now