> Can anyone suggest a method to emulate the functionality of the SQL > "exists" or "in" clause in QUEL? I'm primarily an SQL user but I also > support quite a bit of legacy QUEL code. This problem has cropped up > before and I'm wondering if any QUEL experts out there have an elegant > solution. Have I died and gone to heaven, or did someone ask a QUEL question? > In SQL, I would write: > > select t1.col > from table1 t1 > where t1.col not in (select t2.col from table2 t2) range of t1 is table1, t2 is table2 retrieve ( t1.col) where any( t2.all by t1.col where t2.col = t1.col ) = 1 > select t1.col1 > from table1 t1 > where not exists (select t2.col from table2 t2 > where t2.col = t1.col) range of t1 is table1, t2 is table2 retrieve ( t1.col) where any( t2.all by t1.col where t2.col = t1.col ) = 0 There is plenty more where that came from. If performance is an issue you may want to hear about some variants of the above, but this should get you started. ======================================================================== Roy Hann rhann@tnc.com BKB Engineering Ltd., NAIUA Member 11211-76th Avenue, CA-World '97 DBA Track Leader Edmonton, Alberta http://www.tnc.com/bkb T6G 0K2 Tel: (403)497-2409 Canada FAX: (403)436-6055 ========================================================================
© William Yuan 2000
Email William