Thank you.  I never used a "group by" statement before.  I also never created 
a view before.  I will have to work on this.It's funny that you can do it in 
one command from within a report or form.  

Patti



    On Tuesday, September 1, 2020, 3:47:34 AM EDT, 'rehan wyne' via RBASE-L 
<[email protected]> wrote:  
 
  You can not do two things in a single update command rather do it in two step 
as below:
Step 1:create temp view act_cnt_view (ssn, acttype, cnttotal) as select ssn, 
acttype, count(ssn) from activity where acttype='group' group by ssn
pl note by adding where clause in the above view, we restricted to count only 
those records where acttype is 'group'
You can modify the where and group by clause as per your requirements.

Step 2:update BBWomen set SessionCount = t2.cnttotal from BBWomen t1, ACTIVITY 
t2 where t1.SSN=t2.SSN

Regards
Rehan Wyne
    On Tuesday, September 1, 2020, 08:05:52 AM GMT+5, 'Patti Jakusz' via 
RBASE-L <[email protected]> wrote:  
 
 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/280595677.1108357.1598946451343%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/314471734.2243135.1599192158174%40mail.yahoo.com.

Reply via email to