Re: HardCORE QUERY HELP!!!

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Metnetsky <matt(at)uberstats(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: HardCORE QUERY HELP!!!
Date: 2003-03-03 12:41:23
Message-ID: 3E634D73.6010702@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Metnetsky wrote:
> Q: list employee name, job, manager name and salary for those whose salary
> is more than their manager
>
> The quetion may seem kinda dumb, it's for a class and my professor has a
> thing for brain teaser type questions. I attempted doing this with rename
> and a natural join but I can't get the rename to work I think. Any help
> would be much appreciated.
> Thanx
One more version of query you need:

select
e.ename,
e.job,
m.ename as managername,
e.salary
from
emp as e
join emp as m on (e.mgr=m.empno and e.salary>m.salary);

As Rajesh said - for your example data there is no result for such query.

Regards,
Tomasz Myrta

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oleg Samoylov 2003-03-03 13:22:51 Re: Executing SQL commands via triggers without the use of procedures
Previous Message Tomasz Myrta 2003-03-03 12:32:54 Re: pl/pgsql errors