euglug.org

[Eug-lug] SQL/postgres help on a “cross join” ?

작성자

카테고리:



Matthew JarvisFri Apr 28 14:33:25 PDT 2006

Thanks, but that's not it either.... in fact as far as I can tell it's 
virtually the same results....

Looking for the Dept names from Department table to be columns in the 
result table.....

Am I gonna have to sling some code to get this done?


Matthew S. Jarvis
IT Manager
Bike Friday - "Performance that Packs."
www.bikefriday.com
541/687-0487 x140
mattj at bikefriday.com


M. Bitner wrote:
> Something like this maybe?
> 
> select employee.last_name, employee.first_name, department.name, sum(
> timeentry.hours) as tot_hrs
> from timeentry
> join employee on timeentry.emp_id = employee.emp_id
> join department on employee.department_id = department.department_id
> where date( apply_date) > '2006-04-01'
> group by department.name, employee.last_name, employee.first_name
> order by employee.last_name, department.name
>