> I have two tables in my database with a department name.
> One table (department), the name only appears once and it includes all
> departments in the school. In the other table, (courses) department can
> appear several times, but not all departments will be in the table.
> I used the following code to try to get the names of the departments from
> the courses table, but unfortunately I get all occurences of the
> Can someone help me get ony one occurrence of each department from the
> courses table.
> $query = "select departments.department, courses.department from
> departments, courses where departments.department=courses.department";
> $result = mysql_query($query);
Check out MySQL's DISTINCT modifier.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php