Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL question
Rexx <nebacar_nospam_at_eunet.yu> wrote in message
news:7u4cjm$t58$1_at_SOLAIR2.EUnet.yu...
> HI,
>
> can I do in SQL next query
>
> I have table (eg.) T1 with two columns SMM and DATUM
>
> SMM DATUM
> --------- -----------
> 1000 1-10-1997
> 1000 1-10-1998
> 1000 1-10-1999
>
> 2000 1-10-1997
> 2000 1-10-1998
>
> 3000 1-10-1997
> 3000 1-10-1998
> 3000 1-10-1999
>
> 4000 1-10-1997
> 4000 1-10-1998
>
> I need to get "mising " records
>
> 2000 1-10-1999
> 4000 1-10-1999
If you means that the records in your table should form a "matrix", here is the solution:
SQL> create table t1(smm number, datum varchar2(20));
Table created.
SQL> insert into t1 values (1000, '1-10-1997');
1 row created.
SQL> insert into t1 values (1000, '1-10-1998');
1 row created.
SQL> insert into t1 values (1000, '1-10-1999');
1 row created.
SQL> insert into t1 values (2000, '1-10-1997');
1 row created.
SQL> insert into t1 values (2000, '1-10-1998');
1 row created.
SQL> insert into t1 values (3000, '1-10-1997');
1 row created.
SQL> insert into t1 values (3000, '1-10-1998');
1 row created.
SQL> insert into t1 values (3000, '1-10-1999');
1 row created.
SQL> insert into t1 values (4000, '1-10-1997');
1 row created.
SQL> insert into t1 values (4000, '1-10-1998');
1 row created.
SQL>
SQL> select m.*
2 from (select * from (select distinct smm from t1),
3 (select distinct datum from t1)) m, t1
4 where m.smm=t1.smm(+) and t1.smm is null
5 and m.datum=t1.datum(+) and t1.datum is null;
SMM DATUM
--------- -------------------- 2000 1-10-1999 4000 1-10-1999Received on Fri Oct 15 1999 - 12:50:46 CDT