SQL Question - Select if Present ELSE null

SQL Question - Select if Present ELSE null

 

  

Hi DBAs

I need some solution to this problem which i am
facing.
The requirement is
SQL>create table test_kg4
2 (tname varchar2(10)
3 ,date1 date
4 ,size1 number
5 )
6 /

Table created.

SQL>begin
2 insert into test_kg4 values('T1','01-Jan-2003',
100);
3 insert into test_kg4 values('T1','10-Jan-2003',
200);
4 --
5 insert into test_kg4 values('T2','01-Jan-2003',
300);
6 insert into test_kg4 values('T2','12-Jan-2003',
400);
7 --
8 insert into test_kg4 values('T3','01-Jan-2003',
500);
9 insert into test_kg4 values('T3','10-Jan-2003',
600);
10 end;
11 /

PL/SQL procedure successfully completed.

SQL>set linesize 100;
SQL>select * from test_kg4
2 /

TNAME DATE1 SIZE1
---------- ------------------ ------------
T1 01-jan-2003:000000 100
T1 10-jan-2003:000000 200
T2 01-jan-2003:000000 300
T2 12-jan-2003:000000 400
T3 01-jan-2003:000000 500
T3 10-jan-2003:000000 600

6 rows selected.

Now if i pass 01-jan-2003 and 10-jan-2003 as parameter
the output
should appear as

T1 01-jan-2003 100 10-jan-2003 200
T2 01-jan-2003 300 -NA- -NA-
T3 01-jan-2003 500 10-jan-2003 600

Any help would be appreciated.



=====
LayZee DBA

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Oracle LazyDBA home page