Hi,
I hope I can explain this right:
Here is my statement so far:
[code=mysql]
SELECT shift_log.note, shift_log.id, shift_log.times tamp, shift_log.monit or, shift_log.hando ver,
shift_log.start _time, shift_log.finis h_time, shift_log.sunre f, shift_log.hpref , shift_log.hsbcr ef,
CONCAT(users.fn ame, " ", users.lname) AS users_name, equipment.name AS equipment_name, equipment_id";
FROM shift_log, equipment, users, part_usage
WHERE equipment.id = shift_log.equip ment_id AND shift_log.user = users.id AND part_usage.shif t_log_id = shift_log.id
ORDER BY shift_log.times tamp DESC
[/code]
The last AND statement (AND part_usage.shif t_log_id = shift_log.id) in the where clause is not always true, I want to get the info if its there, but allow the statement to run if there are no records, but im lost as to how to do so. As it is i only get results for those that have an entry in part_usage, but I still want the other rows that have no entry in part_usage. Is this possible?
I hope I can explain this right:
Here is my statement so far:
[code=mysql]
SELECT shift_log.note, shift_log.id, shift_log.times tamp, shift_log.monit or, shift_log.hando ver,
shift_log.start _time, shift_log.finis h_time, shift_log.sunre f, shift_log.hpref , shift_log.hsbcr ef,
CONCAT(users.fn ame, " ", users.lname) AS users_name, equipment.name AS equipment_name, equipment_id";
FROM shift_log, equipment, users, part_usage
WHERE equipment.id = shift_log.equip ment_id AND shift_log.user = users.id AND part_usage.shif t_log_id = shift_log.id
ORDER BY shift_log.times tamp DESC
[/code]
The last AND statement (AND part_usage.shif t_log_id = shift_log.id) in the where clause is not always true, I want to get the info if its there, but allow the statement to run if there are no records, but im lost as to how to do so. As it is i only get results for those that have an entry in part_usage, but I still want the other rows that have no entry in part_usage. Is this possible?
Comment