Close Tables all

Create Cursor Mastbred (comp_no I, yearbred I)
Insert Into Mastbred Values (1, 2007)
Insert Into Mastbred Values (2, 2006)
Insert Into Mastbred Values (3, 2007)

Is this what you mean?

Create Cursor OwnPCT (Acct_no C(10), Compno I)
Insert Into OwnPCT Values ("A001", 1)
Insert Into OwnPCT Values ("A002", 2)
Insert Into OwnPCT Values ("A003", 1)
Insert Into OwnPCT Values ("A004", 2)

* Old Statements
Select comp_no ;
from mastbred ;
where yearbred = 2007 ;
into cursor lc_mastbred

Select acct_no ;
from ownpct ;
where compno in (select comp_no from lc_mastbred ) ;
group by acct_no


* New Method
Select acct_no ;
from ownpct ;
where compno in (select All comp_no from Mastbred where yearbred=2007) ;
group by acct_no

Dave Crozier

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of James E Harvey
Sent: 08 August 2007 15:35
To: 'ProFox Email List'
Subject: select question

Is there a "better" way, can it be done in one "select"?

Select comp_no from mastbred where yearbred = 2007 into cursor lc_mastbred

Select acct_no from ownpct where (select comp_no from lc_mastbred) group by
acct_no


James E Harvey
Hanover Shoe Farms, Inc.
M.I.S./Corresponding Officer
Off: 717-637-8931
fax: 717-637-6766
email: [EMAIL PROTECTED]



[excessive quoting removed by server]

_______________________________________________
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/[EMAIL PROTECTED]
** 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