0

Can you help me, i have problem with my query. i have data like bellow :

+------------+---------+-----+ | Date | Prod_ID | Qty | +------------+---------+-----+ | 01/02/2018 | Pencil | 2 | | 01/02/2018 | pencil | 3 | | 01/02/2018 | pencil | 4 | | 01/02/2018 | book | 5 | | 01/02/2018 | ruller | 1 | +------------+---------+-----+ 

but my result as bellow

+------------+---------+-----+ | Date | Prod_ID | Qty | +------------+---------+-----+ | 01/02/2018 | 5 | 15 | +------------+---------+-----+ 

i need my result bellow

+------------+---------+-----+ | Date | Prod_ID | Qty | +------------+---------+-----+ | 01/02/2018 | 3 | 15 | +------------+---------+-----+ 

bellow my query script

select "date", Prod_ID, Qty, from data group by "date", Prod_ID, Qty, order by "date"; 

Thank You,

1 Answer 1

2

You can try the following:

select "date", Count(Distinct Prod_ID) as total_product_count, Sum(Qty) as qty from data group by "date" order by "date"; 
Sign up to request clarification or add additional context in comments.

2 Comments

sorry i forget, i need in row Prod_ID as count. but there i found problem it count all data with duplicate
I edited the query according to your comment. Let me know if this helps.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.