Home » RDBMS Server » Server Administration » join
join [message #373607] Thu, 26 April 2001 06:22 Go to next message
yonca
Messages: 3
Registered: April 2001
Junior Member
i have got a below table,
salary change_date last_change_date rank
170 2/1/01 8/1/01 2
140 8/1/01 1

and i havnt to new view like below that,

salary1 salary2 rank1 rank2
170 140 2 1

thanks for your help
Re: join [message #373617 is a reply to message #373607] Thu, 26 April 2001 18:45 Go to previous message
Robert Moy
Messages: 15
Registered: December 2000
Junior Member
Hello:

There is a way to do it. First, you must create another table just with salary as 170 and rank as 2 from the first table. Then delete that salary and rank from the first table. Afterward into the values from the two table into view.

SQL> create table my_salary3 as
2 select * from my_salary
3 where rank=2;

Table created.

SQL> select * from my_salary3;

SALARY CHANGE_DA LAST_CHAN RANK
--------- --------- --------- ---------
170 2/1/01 8/1/01 2

SQL> delete from my_salary
2 where salary=170;

1 row deleted.

SQL> create view my_salary4(salary1,salary2,rank1,rank2) as
2 select my_salary3.salary,my_salary.salary,my_salary3.rank,my_salary.rank
3 from my_salary3,my_salary;

View created.

SQL> select * from my_salary4;

SALARY1 SALARY2 RANK1 RANK2
--------- --------- --------- ---------
170 120 2 1

I hope this will help. Please reply back if you need more help.
Previous Topic: Query
Next Topic: Oracle error
Goto Forum:
  


Current Time: Sat Jun 29 00:27:05 CDT 2024