this is my code when i run it on mysql it runs successfully but when i run on Postgres it doesn't run and give error as total_rate column doesn't exist:
create table gross (
id numeric primary key ,
name text ,
rate numeric ,
quantity numeric
);
insert into gross values ( 1 ,'bhindi os' , 10 , 5);
insert into gross values ( 2 , 'palak' , 15 , 4);
insert into gross values ( 3 , 'paneer' , 20 , 2);
insert into gross values ( 4 , 'paneer' , 18 , 2);
insert into gross values ( 5 , 'paneer' , 13 , 2);
-- select * from gross where quantity >3 order by quantity ;
-- select name , sum(quantity) from gross group by name ;
-- select SUM(quantity) from gross ;
-- select * from gross where name like '%pal%';
-- select name ,Sum(quantity) as total_order from gross group by name order by name desc ;
select name , sum(rate) as total_rate from gross
group by name
having total_rate > 10;