I've been battling to try to chain something together but I"m failing, I 
have the following snippet of code from a stored proc function that I'm 
porting:

Delete from table1 a 
where a.status <> 'O' 
or exists (select b.contract_nbr 
from contract b 
where b.contract_date = a.contract_date 
and b.contract_nbr  = a.contract_nbr 
and b.contract_sfx  = a.contract_sfx 
and ((b.status <> 'O') or 
(b.orig_par = b.tba_Par_Allocated + b.tba_Par_Paired_Off + 
b.tba_Par_Given_Up)) 
); 

not sure at all how to chain up an "or exists"

the where clause seems pretty straight ahead until the last and criteria 
which is an or expression between a not equals clause and a second clause 
which requires the summation of numeric fields who sum is to be compared to 
a field in the second table.

I get that I'm going to need to setup a join i.e. via Sequel since I don't 
think that Sequel can specify it the same way the stored proc does.

Help is greatly appreciated with the above code. Also in general I guess 
I'm failing how to construct nested boolean queries such as demonstrated 
above.


-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to