* O'Neill, Ciaran
[...]
> I want to get everything from this table, even if there is no
> corresponding record in the personnel table.
This is a typical task for a LEFT JOIN, try something like this:
select workorders.jcn AS "WO Number",
workorders.seq AS "WO Seq",
workorders.contact AS Contact,
workorders.summary AS Summary,
class.name AS Class,
severities.name AS Severity,
DATE_FORMAT(workorders.createdon, '%Y-%m-%d') AS WOCreatedOn,
CONCAT(personnel.lastname, ", ", personnel.firstname)
as ClosedBy,
workorders.closedon AS WOClosedOn,
workorders.totalhours AS TotalHours,
accounts.name AS Customer,
products.name AS CallCatagory,
statuses.name AS Status
FROM workorders, class, severities, accounts,
products, statuses LEFT JOIN personnel ON personnel.id = workorders.closedby
WHERE class.id = workorders.clid
and severities.id = workorders.severity
and accounts.id = workorders.account
and products.id = workorders.product
and statuses.id = workorders.status
ORDER BY workorders.jcn;
<URL: http://www.mysql.com/doc/en/JOIN.html >
--
Roger
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]