Hi Erik, > In the "files" table, each row corresponds to a separate file. There's > all sorts of additional criteria, but the only one that matters to my > question is the column called "div_id". That's right, the number in
That's exactly what I would recommend you to do. As you wrote, you can easily add more divisions or change division names without affecting the data stored in files or modifying the table structure. > SELECT files.file_name > FROM files > WHERE files.file_id = divisions.div_id > AND divisions.div_name = "division1" ; That's nearly correct. You could use SELECT files.file_name FROM files, divisions WHERE files.file_id = divisions.div_id AND divisions.div_name = 'divisions1'; Note that both tables you wish to include in the query need to be written after the FROM command. This type of query is called a JOIN. You can find more information on that in the MySQL manual and at http://www.devshed.com/Server_Side/MySQL/Join. At devshed, they have some other interesting material on MySQL as well. Additionally, you should always use single ticks (') around strings. Double ticks work with MySQL, but since this violates the ANSI SQL standards, you will run into problems if you ever decide to port your application to another database system. Jens --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php