That worked perfectly. I've never had much luck with joins! Thanks.
Ciaran. -----Original Message----- From: Roger Baklund [mailto:[EMAIL PROTECTED] Sent: 07 April 2004 12:52 To: [EMAIL PROTECTED] Cc: O'Neill, Ciaran Subject: Re: Joins * 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 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ********************************************************************** -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]