0

TABLE STRUCTURE:

ID    NAME    SUM_HOURS   WEEK

1     name1     32        2018-01-01
1     name1     30        2018-02-01
1     name1     35        2018-03-01

Below is my Query for above table:

SELECT id                                    id,
e.name                                       name,
SUM(f.hours)                                 sum_hours,
fc.from_date                                 week,
FROM factdaily f, finance_calendar_full  fc, employee e
WHERE f.date                    = fc.date
AND f.emp_id                    = e.id 
AND f.date                   >= valid_from
AND f.date                   <= valid_to       
GROUP BY week
HAVING sum_hours > 0

DESIRED TABLE STRUCTURE:

ID NAME    2018-01-01 2018-02-01 2018-03-01
1  name1   32         30          35

Any help is much appreciated as i way not able to figure out.

Shadow
  • 33,525
  • 10
  • 51
  • 64
Wolverine
  • 455
  • 3
  • 8
  • 26

0 Answers0