Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create this table?
Message
 
 
To
30/07/2003 13:18:45
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00815002
Message ID:
00815043
Views:
18
You can build such list any time you need it. Try
SELECT * ;
	FROM mytable mt1 ;
	WHERE Relfile = SPACE(6) ;
		AND NOT EXISTS ( SELECT * FROM mytable mt2 WHERE mt2.Relfile = mt1.id)
* or
SELECT * ;
  FROM mytable ;
  WHERE Relfile = SPACE(6) ;
    AND id NOT IN ( SELECT DIST relfile FROM mytable )
Make sure that you've index on Relfile.

>I'm trying to create an on-going table that will contain data based on information in a primary table but can't quite wrap my mind around the proper solution. I've been building a local view for this data but find it is a bit slow to create (a few seconds but when you have to do it over and over again, it adds up) and am hoping for a cleaner solution.
>
>Here's the situation. I have a table that contains information on people. It contains the usual descriptive fields such as first and lastnames, dob, etc. and each record has a unique id associated with it. Since any one person may be associated with others to make up a "team", the table includes a field called "relfile" which holds the unique id for the team leader. Here are the business rules for a team.
>(a) There can only be one team leader per team.
>(b) A person can only lead one team at any given time.
>(c) A person can only be a member of one team at any given time.
>(d) A person can NOT be a member of one team and a leader of another.
>(e) A team can have an unlimited number of members.
>
>So if we have a three member team, the table records might look like this:
>    Team Leader                MEMBER A               MEMBER B
>ID   '001010'                  '001103'                '001309'
>Last    Alpha                    Beta                   Jones
>First   Mary                     Susan                   Tom
>Relfile                         '001010'                '001010'
>To create new teams, I want to see a list of potential team leaders. This would include only those people who are not currently team leaders AND who are not members of an existing team. Could someone suggest a way to create and maintain a table of the potential team leaders which would be efficient and quick? Bear in mind the member table is updated multiple times each day!
>
>Thanks in advance!!!
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform