I've been asked to add a field to a download capture sstem I've got.
I've two tables, one that contains all the individual files info 
('single_file'), and one that records the downloads 
('completed_downloads').
All good...

I've been asked to add a file_category (article, brochure, exe etc...)
And I've gone through the 'single_file' table and added the field 
'file_cat' and populated all entries with data.
I've also added a field called 'file_cat' to 'completed_downloads' but 
they are all blank.
Both tables share a common field, called 'file_name'

What I'd like to do is:
Update all entries 'file_cat' on 'completed_downloads' taking the value of 
'file_cat' from 'single_file' where 'single_file.file_name' = 
'completed_downloads.filename'

Make sence?

Well, I've come up with this...
UPDATE completed_downloads SET file_cat = 'brochure' WHERE 
single_file.file_name = completed_downloads.file_name

but this will simply update ALL 'file_cat' to brochure, which is not what 
I want... (In fact the Query above does nothing, it doesn't work)

Now, the picture version...
I need to populate file_cat.
Hope it all makes sence?

Can anyone help?

====================================
single_file

file_name
file_cat
Id
Splash text
Locked
123.pdf
Brochure
101
Blah blah
1
Abc.pdf
Article
245
Blah blah
0
Runit.exe
Program
234
Blah blah
1

Completed_downloads

File_name
Date_downloaded
File_cat
User
Country
http_referer
Users_ip
123.pdf
10/10/03

Bob
Uk
Random url
1.1.1.1
123.pdf
01/01/99

Sally
USA
URL
2.2.2.2
Abc.pdf
12/04/01

Pete
Usa
URL
3.3.3.3
123.pdf
12/04/01

Pete
Usa
URL
3.3.3.3
Runit.exe
24/11/02

John
Aus
URL
4.4.4.4
123.pdf
24/11/02

John
Aus
URL
4.4.4.4
123.pdf
11/07/01

Greg
Poland
URL
8.8.8.8
Runit.exe
11/07/01

Greg
Poland
URL
8.8.8.8
123.pdf
12/07/01

Greg
Poland
URL
8.8.8.8

=========================================


*********************************************************************
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***********************************************************************

Reply via email to