I'm not sure how you see value 3 gets all those results.
Have a look at this code:

[code]   
ACTIVATE SCREEN    
CLEAR    
CREATE CURSOR table2 (table1 I, table1x I, table3 I)   
insert into table2(table1, table1x, table3) values(1,0,1)   
insert into table2(table1, table1x, table3) values(1,0,2)   
insert into table2(table1, table1x, table3) values(1,0,3)   
insert into table2(table1, table1x, table3) values(2,0,4)   
insert into table2(table1, table1x, table3) values(2,1,0)   
insert into table2(table1, table1x, table3) values(2,0,5)   
insert into table2(table1, table1x, table3) values(3,2,0)   
insert into table2(table1, table1x, table3) values(3,0,6)   

DoSelect(1)   
DoSelect(2)   
DoSelect(3)   

PROCEDURE DoSelect   
LPARAMETERS nValue   
SELECT table1 as result FROM table2 WHERE table1 = ?nValue AND table1 <> 0 ;

   UNION ;
      select table1x as result FROM table2 WHERE table1 = ?nValue AND
table1x <> 0 ;
   UNION ;
      select table3 as result FROM table2 WHERE table1 = ?nValue AND table3
<> 0 ;
   UNION ;
      SELECT table1 as result FROM table2 WHERE table1x = ?nValue AND table1
<> 0;
   UNION ;
      select table1x as result FROM table2 WHERE table1x = ?nValue AND
table1x <> 0 ;
   UNION ;
      select table3 as result FROM table2 WHERE table1x = ?nValue AND table3
<> 0 ;
   UNION ;
      SELECT table1 as result FROM table2 WHERE table3 = ?nValue AND table1
<> 0 ;
   UNION ;
      select table1x as result FROM table2 WHERE table3 = ?nValue AND
table1x <> 0 ;   
   UNION ;   
      select table3 as result FROM table2 WHERE table3 = ?nValue AND table3
<> 0 ;   
   INTO CURSOR resultset   
   SELECT resultset    
   LIST FIELDS result   
ENDPROC   
[/code]

-----Original Message-----
From: Eurico Chagas Filho
Sent: Tuesday, September 08, 2009 4:54 PM


I got this problem to solve and I need some help.
table2(table1 I, table1x I, table3 I).
insert into table2(table1, table1x, table3) values(1,0,1)
insert into table2(table1, table1x, table3) values(1,0,2)
insert into table2(table1, table1x, table3) values(1,0,3)
insert into table2(table1, table1x, table3) values(2,0,4)
insert into table2(table1, table1x, table3) values(2,1,0)
insert into table2(table1, table1x, table3) values(2,0,5)
insert into table2(table1, table1x, table3) values(3,2,0)
insert into table2(table1, table1x, table3) values(3,0,6)
*-------------
My result set should be for table1 value 1; result( 1,2,3)
for table1 value 2; result(4,1,2,3,5)
for table1 value 3; result(1,2,3,4,5,6) It could go deeper...

TIA, E.




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/001701ca30cc$24253400$6c6f9c...@com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to