MySQL Forums
Forum List  »  Newbie

MySQL LEFT JOIN problem.
Posted by: Scott Hamm
Date: August 23, 2004 12:31PM

SELECT
concat(associates.lastname,', ',associates.firstname) as Operator,
mrdaily.kronoshours as Hours,
mrdaily.pto as PTO,
mrcategories.category as Category,
mrentries.quantity as quantity,
mrentries.pages as pages,
mrentries.orders as orders,
mrentries.hours as hours,
round(mrentries.quantity/mrentries.hours,2) as 'Qty PPH',
round(mrentries.pages/mrentries.hours,2) as 'Pages PPH',
round(mrentries.orders/mrentries.hours,2) as 'Orders PPH'
FROM
mrentries,
associates,
mrdaily,
mrcategories
WHERE
mrentries.iddaily=mrdaily.id
AND
associates.id=mrdaily.idassociates
AND
entrydate='2004-08-03'
AND
mrcategories.id=mrentries.category;


+-----------------------------+-------+------+---------------------+----------+-------+--------+-------+---------+-----------+------------+
| Operator | Hours | PTO | Category | quantity | pages | orders | hours | Qty PPH | Pages PPH | Orders PPH |
+-----------------------------+-------+------+---------------------+----------+-------+--------+-------+---------+-----------+------------+
| Alexander, Lee | 8 | 0 | QA Taping PM | 2549 | 0 | 0 | 6.67 | 382.16 | 0.00 | 0.00 |
| Alexander, Lee | 8 | 0 | Admin | 0 | 0 | 0 | 0.58 | 0.00 | 0.00 | 0.00 |
| Anderson, Purlie | 6.33 | 0 | PM Orders | 90 | 0 | 0 | 2.17 | 41.47 | 0.00 | 0.00 |
| Anderson, Purlie | 6.33 | 0 | Survey | 73 | 0 | 0 | 1.42 | 51.41 | 0.00 | 0.00 |
| Anderson, Purlie | 6.33 | 0 | BlackLight | 55 | 0 | 0 | 1 | 55.00 | 0.00 | 0.00 |
| Anderson, Purlie | 6.33 | 0 | 10% Inspection | 17 | 0 | 0 | 1.33 | 12.78 | 0.00 | 0.00 |

How can I single out associates with each category on its own column using LEFT JOIN? I'm confused on how I should use LEFT JOIN, with mysql whining with errors.

Options: ReplyQuote


Subject
Written By
Posted
MySQL LEFT JOIN problem.
August 23, 2004 12:31PM
August 24, 2004 06:14AM
August 24, 2004 06:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.