Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to visualize the result to show only 3 rows

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;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading