Home » SQL & PL/SQL » SQL & PL/SQL » I need a SQL-Statement or function
I need a SQL-Statement or function [message #20589] Wed, 05 June 2002 22:21 Go to next message
Anke
Messages: 8
Registered: November 1999
Junior Member
I have a problem with the connection from two tables (atest and btest).
SQL> desc atest
Name Null? Typ
----------------------------------------- -------- ----------------------------
GEMARKUNG NOT NULL VARCHAR2(4)
RECHTSWERT VARCHAR2(12)
HOCHWERT VARCHAR2(12)
FLUR VARCHAR2(10)
FLST_NR VARCHAR2(10)

SQL> select * from atest;

GEMA RECHTSWERT HOCHWERT FLUR FLST_NR
---- ------------ ------------ ---------- ----------
2222 1231233.3 1112221.2 1 123/100
2223 2222222.1 2222222.2 1 1/2
2224 3333333.1 3333333.2 1 12/12
2225 1111111.1 1111111.2 15 1234/1234
2222 1231234.2 1231234.3 1 12345/10

SQL> desc btest
Name Null? Typ
----------------------------------------- -------- ----------------------------
GEMARKUNG NOT NULL VARCHAR2(20)
RECHTSWERT NUMBER(16,6)
HOCHWERT NUMBER(16,6)

SQL> select * from btest;

GEMARKUNG RECHTSWERT HOCHWERT
-------------------- ---------- ----------
2222/001/12345/0010
2223/001/00001/0002 22222221 22222222
2224/001/00012/0012 33333331 33333332
2222/001/00123/0100 12312333 11122212
2225/015/01234/1234 11111111 11111112

SQL> spool off

In table atest is the identify gemarkung,flur,flst_nr and in btest is the identify gemarkung. Now i want compare the two table.
Thats why I have to do a relation between table atest gemarkung,flur,flst_nr and table btest gemarkung.

excample: atest.gemarkung,atest.flur,atest.flst_nr 2222,1,123/100 btest.gemarkung 2222/001/00123/0100

I need a SQL-Statement as

select * from atest,btest where atest.gemarkung,atest.flur,atest.flst_nr=btest.gemarkung;
Can you help me?
Re: I need a SQL-Statement or function [message #20594 is a reply to message #20589] Thu, 06 June 2002 03:21 Go to previous messageGo to next message
shyampaliyath
Messages: 22
Registered: May 2002
Junior Member
hai Anke,
c if u wanna compare the atest value with the btest value here is the query

select * from (select GEMARKUNG from atest
minus
select GEMARKUNG from btest) b,atest a where
a.GEMARKUNG =b.GEMARKUNG

for comparing btest with atest value then query is

select * from (select GEMARKUNG from btest
minus
select GEMARKUNG from atest) b,btest a where
a.GEMARKUNG =b.GEMARKUNG

with regards
Shyam
Re: I need a SQL-Statement or function [message #20597 is a reply to message #20594] Thu, 06 June 2002 03:56 Go to previous message
Anke
Messages: 8
Registered: November 1999
Junior Member
Thanks, bu I have my problem not right said. In the end of my task,
I have to update the column rechtswert,hochwert from btest with the column rechtswert,hochwert from atest with the difficult identify.
In my excample is that atest.gemarkung,atest.flur,atest.flst_nr 2222,1,123/100 = btest.gemarkung 2222/001/12345/0010.
I hope you understand me.
Thanks for the help
Anke
Previous Topic: Verifying if the data(one row) fulfilling a select criteria exists in the table or not
Next Topic: increment rowcount with each value retreived for a main column
Goto Forum:
  


Current Time: Tue Apr 23 12:02:14 CDT 2024