I am using mySQL.
My query wasn't really "why does the second example work?", but more "Why am I getting an error on the first one?"
Simply put, I just cannot reference some of the fields, and have no idea why. For example, the following results in an error, even though that field exists.
SELECT FJAFFdepartments.categories_id
Here's the info from phpmyadmin on that table just to demonstrate that I am not spelling the name wrong or anything:
FJAFFdepartments
Field Type Attributes Null Default Extra
categories_id int(11) Yes 0
categories_name varchar(32) Yes NULL
categories_image varchar(64) Yes NULL
parent_id int(11) Yes 0
categories_sort int(3) Yes NULL
Indexes : Keyname Type Cardinality Field
categories_id UNIQUE 65 categories_id
I did wonder whether this was related to some reserved term, but I have been renaming and testing and still had the problem.