I'm working on making a new page for my company and I'm having trouble with the SQL.
The following code is used for filling in the search options on the Staff Members page to sort by Department.
$depts= db_query('SELECT dept_id,dept_name FROM '.DEPT_TABLE);
What I've done is added another column to ost_department (OnCall). This is either a 0 for "no" or a 1 for "yes". If the department is one that has staff that rotates through an OnCall schedule then it gets a 1 otherwise its a 0.
I have an OnCall page (right now mostly just a copy of directory.php) but I'm trying to change the above code so that it will list only the departments that have staff Oncall.
so the actual query would be:
select dept_id,dept_name from ost_department where OnCall=1;
So I need help with modifying the original code above into the latter query.
Thanks for any assistance!