Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not to select records in the many table
Message
From
20/01/2009 10:35:09
 
 
To
20/01/2009 10:13:57
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01375445
Message ID:
01375470
Views:
7
>>>Hi,
>>>I have two tables with one-to-many relation.
>>>Is there a way - in one sql statement - to count all the records
>>>which have only one record relation in the "many" table.
>>>
>>>Thanks.
>>
>>Untested:
>>
>>
>>SELECT PKinOneTable ;
>>   FROM TheManyTable ;
>>   GROUP BY PKinOneTable ;
>>   HAVING CNT(*) = 1 ;
>>   INTO CURSOR OnlyOneChild
>>
>>
>>Tamar
>
>Thanks, it's ok but the problem is that it doesn't count the records but lists them.
SELECT PKinOneTable ;
   FROM TheManyTable ;
   GROUP BY PKinOneTable ;
   HAVING CNT(*) = 1 ;
   INTO Array laResult
?laResult
Previous
Reply
Map
View

Click here to load this message in the networking platform