It's a temporary table and I only want to do this for producing quick data for 
people.  I never used a "group by" statement before.  I will have to work on 
this.  
Thank you.  
Patti


    On Tuesday, September 1, 2020, 3:32:12 AM EDT, Tony IJntema 
<[email protected]> wrote:  
 
  

 
 
Patti, 
 
 
To start with,  it is probably not an good idea to store a result in a seperate 
column, because it represents only the current situation. 
 
 
You also can create a view which always  will reflect the actual situation.
 
However if you still want to update a column in a table, here a is solution.  
 
 
Create a (temp) view using a group by and then perform an update command
 
CREATE  VIEW ACTCOUNT ( SSN,  TotalActivities )  AS SELECT   SSN,  (Count(*))  
FROM  Activities   group by SSN where ActType  = 'Group' 
 
 
Update BBwomen set SessionCount = T2.TotalActivities from BBwomen T1, ACTCOUNT 
T2 where t1.SSN = T2.SSN
 
 Hope this works
  
  Tony 
  Op 1-9-2020 om 04:35 schreef 'Patti Jakusz' via RBASE-L:
  
 
 Hello Rbase Pros, 
  I have struggled with an update command for years.  Everytime I have to do 
it, I end up writing a program.  I know there must be a way to do this. 
  I have one table (BBWomen), where I want to store the number of related 
records from a second table. I want to count the number of times each woman 
attended a group activity.  So I have an Activity table with client's SS# and 
Activity Type and Activity Date with hundreds of thousands of rows of data.  
And I want to store it in the BBWomen table in a column called SessionCount, 
  
  I tried a dozen command syntaxes and none of them worked.  Here is a sample.
  
  update BBWomen set SessionCount = (count(*)) from ACTIVITY t1, BBWomen t2 
where t1.SSN=t2.SSN and t1.ActType='Group' 
  update BBWomen set SessionCount = (count(SSN)) from ACTIVITY t1, BBWomen t2 
where t1.SSN=t2.SSN and t1.ActType='Group' 
  update BBWomen set SessionCount = (count(SSN)) from ACTIVITY where SSN=SSN 
and ActType='Group' 
  update BBWomen set SessionCount = (count(SSN)) in ACTIVITY where SSN=SSN and 
ActType='Group' 
  Can someone help? Thank you!! Patti
   -- 
 For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
 --- 
 You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected].
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/12090348.945037.1598927732957%40mail.yahoo.com.
 

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/464557f0-a959-293a-24fb-ee67a9590ef6%40cio-bv.nl.
  

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/2097641435.2248457.1599191954343%40mail.yahoo.com.

Reply via email to