EMPLOYEE table contains: emp, first, last (emp is unique key)
TIMESHEET table contains: emp, timestamp, hours
I want to report employee name and total hours.
So far, I've come up with:
SELECT min(emp.first) as first, min(emp.last) as last, sum(ts.hours) FROM timesheet ts, employee empWHERE ts.emp =
emp.empGROUPby emp.empORDER BY last, first;
It seems silly to specify "min" when I know there is only one value per emp!
SELECT first, last, sum(ts.hours) FROM timesheet ts, employee empWHERE ts.emp = emp.emp GROUP by emp.emp, first,
lastORDERBY last, first;
It seems silly to specify extraneous "group by" fields.
Is there a 'better' way to write this SQL?
Frank