Re: Hair Being Pulled Out...
Paul Bokor wrote:
> I have two tables, STAFF (a staff list) and DIARY (a diary). They both have a field titled
> FULLNAME. DIARY also has fields titled DATE and ENTRY.
>
> I am trying to get a day's worth of entries where the recordset shows all members of staff, and the
> DIARY.ENTRY shows either the entry or NULL where there is no entry for that person on that day.
Untested:
SELECT
staff.fullname,
IFNULL(diary.entry, 'In the Office')
FROM staff
LEFT JOIN diary ON diary.fullname = staff.fullname AND diary.date = <<some date>>
Where I assume there is at most one record per fullname per date in the diary table.
--
felix
Please use
BBCode to format your messages in this forum.