Home > Software design >  How to visualize the result to show only 3 rows
How to visualize the result to show only 3 rows

Time:10-12

I`m trying to show in my table only 3 rows and they need to contain from Calendar_month_number numbers 4,5,6 https://i.stack.imgur.com/SzYgY.png

any suggestions

    select s.PROD_ID,t.DAY_NUMBER_IN_MONTH,t.CALENDAR_MONTH_NUMBER,sum(s.AMOUNT_SOLD)
from CUSTOMERS c join SALES s
on c.CUST_ID=s.CUST_ID
join TIMES t
on s.TIME_ID=t.TIME_ID
where s.PROD_ID = 5
and t.TIME_ID BETWEEN '01-APR-00'and '01-JUL-00'
group by s.PROD_ID,t.DAY_NUMBER_IN_MONTH,t.CALENDAR_MONTH_NUMBER
having sum(s.AMOUNT_SOLD) > 0;

CodePudding user response:

Well, apparently this would be

select t.CALENDAR_MONTH_NUMBER,sum(s.AMOUNT_SOLD)
  from CUSTOMERS c
  INNER JOIN SALES s
    on c.CUST_ID=s.CUST_ID
  INNER JOIN TIMES t
    on s.TIME_ID=t.TIME_ID
  where s.PROD_ID = 5 and
        t.TIME_ID BETWEEN '01-APR-00'and '01-JUL-00'
  group by t.CALENDAR_MONTH_NUMBER
  having sum(s.AMOUNT_SOLD) > 0;
  • Related