0

Hi to all,
I created following table
---------------------------------------------------------------------------

create table Interiors(no integer, name varchar, type varchar, dateofstock datetime, price decimal(6,3), discount numeric(6,2))

-----------------------------------------------------------------------------

i want to solve these two queries.
1. Display the type, sum of price and average of discount by grouping type as 'baby cot'.
2. Display the type, maximum and minimum of price by grouping type as 'baby cot'.
I wrote following stmt.s for each resp.

----------------------------------------------------------------------------

1. select type, sum(price), avg(discount) from Interiors group by 'baby cot'.
2. select type, max(price), min(price) from Interiors group by 'baby cot'.

---------------------------------------------------------------------------

I got following error same for both like that 'type is not an aggregate fun. or it dont have GROUP BY' clause. What should I do for solving that queries.

Thanks & regards,
Pooja.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Momerath
0

select type, sum(price), avg(discount) from interiors where name = 'baby cot' group by name

Not tested, YMMV.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.