Home » SQL & PL/SQL » SQL & PL/SQL » question
question [message #39037] Sun, 09 June 2002 21:01 Go to next message
Suresh
Messages: 189
Registered: December 1998
Senior Member
is there a any function called Exist, similar to sybase in oracle.
i have to return one value in either of my filter.
select t.tester_cd, t.test_name from tester t, result r, workinghrs w
where
t.tester_id = r.tester_id and
t.tester_id = w.tester_id and
((t.test_case1 = 'UPDATE') or (t.test_case1 = 'ADD' and test_dt in (select min(test_dt) from workinghrs where tester_id = t.tester_id))
order by t.tester_id;

if there is update i have to return tester_id who did update else tester_id of initial addition.

will appreciate any help, please post if you need more info

suresh
Re: question [message #39041 is a reply to message #39037] Mon, 10 June 2002 00:59 Go to previous message
Subhash
Messages: 105
Registered: October 2001
Senior Member
You can use decode function to achieve this
Eg:
Select Decode(test_case1,'UPDATE',tester_id,'ADD',(Select b.testerid from tester b where b.ttest_dt=(select min(c.test_dt) from workinghrs c ))) from tester a

You have to ensure the join-conditions between the tables proper
Previous Topic: Re: Hierarchical List
Next Topic: from sysdate
Goto Forum:
  


Current Time: Thu Apr 25 12:19:59 CDT 2024