× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hey Donna,

This should work for you:

update afile a
set a.count = ( select case when IfNull( b.f6,' ' ) != ' ' then 1 else
0 end +
case when IfNull( b.f7,' ' ) != ' ' then 1 else
0 end +
case when IfNull( b.f8,' ' ) != ' ' then 1 else
0 end +
case when IfNull( b.f9,' ' ) != ' ' then 1 else
0 end +
case when IfNull( b.f10,' ') != ' ' then 1 else
0 end +
case when IfNull( b.f11,' ') != ' ' then 1 else
0 end +
case when IfNull( b.f12,' ') != ' ' then 1 else
0 end +
case when IfNull( b.f13,' ') != ' ' then 1 else
0 end +
case when IfNull( b.f14,' ') != ' ' then 1 else
0 end +
case when IfNull( b.f15,' ') != ' ' then 1 else
0 end
from bfile b
where b.f1 = a.f1
and b.f2 = a.f2
and b.f3 = a.f3
and b.f4 = a.f4
and b.f5 = a.f5 )
-- You can add the following 'where' clause to only update rows in afile
that exist in bfile
-- or do not add it to set to zero(0) the count column on afile rows that
do not exist in bfile.
where exists ( select *
from bfile
where f1 = a.f1
and f2 = a.f2
and f3 = a.f3
and f4 = a.f4
and f5 = a.f5 )

hth

donna lester wrote:

Hello All,
My problem is as below:
====================================================================
When
Field1 of AFILE Equal to Field1 of BFILE
Field2 of AFILE Equal to Field2 of BFILE
Field3 of AFILE Equal to Field3 of BFILE
Field4 of AFILE Equal to Field4 of BFILE
Field5 of AFILE Equal to Field5 of BFILE
I will have to see if there are any entries in Field6,Field7,Field8,Field9,Field10,Field11,Field12,Field13,Field14,Field15 of BFILE...
(All these 10 fields from Field6 to Field15 are 1 char defined)
If there are entries in all 10 fields then the count is 10
If there are entries in 9 fields then the count is 9
If there are entries in 8 fields then the count is 8
If there are entries in 7 fields then the count is 7
If there are entries in 6 fields then the count is 6
If there are entries in 5 fields then the count is 5
If there are entries in 4 fields then the count is 4
If there are entries in 3 fields then the count is 3
If there are entries in 2 fields then the count is 2
If there are entries in 1 fields then the count is 1
If there are no entries in any of the fields then the count is 0...
what I want to do is
I want to insert this count field in the AFILE when each record of AFILE is equal to its matching record in BFILE
based on the below conditions
Field1 of AFILE Equal to Field1 of BFILE
Field2 of AFILE Equal to Field2 of BFILE
Field3 of AFILE Equal to Field3 of BFILE
Field4 of AFILE Equal to Field4 of BFILE
Field5 of AFILE Equal to Field5 of BFILE
All help is greatly appreciated!

Thanks,
Donna


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.