how do I - find out how many records match abc and how many macth xyz 
Author Message
 how do I - find out how many records match abc and how many macth xyz

I like to write a little code to update a sql table called files. In this
table exists the name of all the files in several directories. Each record
contains the filename, directory name, date, total and today fields.
I like this code to count how many records are in each directory and then
write the total to the total field. It is not important what is the name of
file, but whether was put in there today.

Anyone can help me, I have been stumped on this for the longest time.

Thanks,

Kam



Sun, 10 Jul 2005 09:30:41 GMT  
 how do I - find out how many records match abc and how many macth xyz

Quote:
> I like to write a little code to update a sql table called files. In
> this table exists the name of all the files in several directories.
> Each record contains the filename, directory name, date, total and
> today fields. I like this code to count how many records are in each
> directory and then write the total to the total field. It is not
> important what is the name of file, but whether was put in there
> today.

> Anyone can help me, I have been stumped on this for the longest time.

It might help if you defined the actual table layout since it doesn't make a
lot of sense to me that you'd have the total on every record.... to count
the number of files in each directory you can use something like
select directorypath,count(*) from thetable group by directorypath


Sun, 10 Jul 2005 10:19:04 GMT  
 how do I - find out how many records match abc and how many macth xyz

Hi,
  this may help,

   "select directory name,count(*) from files group by
directory name"

    else be more specific abut the question

venuvrk

Quote:
>-----Original Message-----
>I like to write a little code to update a sql table

called files. In this
Quote:
>table exists the name of all the files in several

directories. Each record
Quote:
>contains the filename, directory name, date, total and
today fields.
>I like this code to count how many records are in each
directory and then
>write the total to the total field. It is not important
what is the name of
>file, but whether was put in there today.

>Anyone can help me, I have been stumped on this for the
longest time.

>Thanks,

>Kam

>.



Sun, 10 Jul 2005 16:46:53 GMT  
 how do I - find out how many records match abc and how many macth xyz

I have been asked to be more specific about this question, hence the new
post.

I have a table called files, it has the following fileds:
id,Date,dirnm,filenm
1002,01221003,help,file1.doc
1003,01222003,help,file2.doc
1004,01222003,help,file3.doc
1005,01222003,help,file4.doc
1006,01221003,faq,file22.doc
1007,01221003,faq,file23.doc
1008,01222003,faq,file24.doc
1009,01222003,faq,file33.doc

Second table called totals
id,dirnm,totl,tday
1,help,4,3
2,faq,4,2

What I would like to find out, is how to get the number of records on table:
files and write it to table: totals. How many recods are in each directory
and how many are from today.

I hope this simplifies my question. I really appreciate all you guys' help.

Kam



Tue, 12 Jul 2005 06:43:16 GMT  
 how do I - find out how many records match abc and how many macth xyz

Quote:
>-----Original Message-----
>I have been asked to be more specific about this

question, hence the new
Quote:
>post.

>I have a table called files, it has the following fileds:
>id,Date,dirnm,filenm
>1002,01221003,help,file1.doc
>1003,01222003,help,file2.doc
>1004,01222003,help,file3.doc
>1005,01222003,help,file4.doc
>1006,01221003,faq,file22.doc
>1007,01221003,faq,file23.doc
>1008,01222003,faq,file24.doc
>1009,01222003,faq,file33.doc

>Second table called totals
>id,dirnm,totl,tday
>1,help,4,3
>2,faq,4,2

>What I would like to find out, is how to get the number

of records on table:
Quote:
>files and write it to table: totals. How many recods are
in each directory
>and how many are from today.

>I hope this simplifies my question. I really appreciate
all you guys' help.

>Kam

>To find out how many records and then to insert these

records you need to do use SQL.

The SQL for finding out how many records there are from
the file table is as follows :

"select count(*) as num_of_files from files"

To insert records from the file table into the totals
table you will need to use the following :

"Insert into totals(id,dirnm) Select id,dirnm from files".

Notice that you can only insert identical field types
from table into the other that is why you cannot insert
anything into the tot1 or tday columns of the totals
table.

            I hope that this helps

- Show quoted text -

Quote:

>.



Wed, 13 Jul 2005 22:48:54 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. VB%: Finding matching records in a Record set...

2. Finding records that don't match

3. Seek Nearest Match if exact match not found ?

4. Seek Nearest Match if exact match not found ?

5. Checking for matching records in two tables with different record structures

6. selecting matching records

7. Matching Records

8. Delete a record with no match?

9. Determine if value in bound textbox does not match current record

10. I want to select records matching parameters (???)

11. no matching records

12. record sections do not match data source ( data report)

 

 
Powered by phpBB® Forum Software