I'm hoping someone might take pity on a newbie to queries in SS. Well to be honest a newbie to queries in general. i have limited SQL exeperience.
Let's say I create the dataobject below
class StaffMember extends DataObject {
static $db = array(
'FirstName' => 'Text',
'Lastname' => 'Text',
'Department' => 'Text'
);
Assuming I have several departments one of which is Sales, and I want to display just the staff members from Sales... I would guess I would write something like
function SalesStaff(){
$SS = DataObject::get("StaffMember", "Department = Sales", "LastName DESC", null, null);
return $SS;
}
and then in the page I want to display it in
<table >
<tr>
<th scope="col">Department</th>
<th scope="col">Last Name</th>
<th scope="col">First Name</th>
</tr>
<% control SalesStaff %>
<tr>
<td>$Department</td>
<td>$LastName</td>
<td>$FirstName</td>
</tr>
<% end_control %>
</table>
Am I anywhere even close??
If anyone has time to analyze my novice ramblings it would be greatly appreciated