pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Metnetsky <matt@uberstats.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: HardCORE QUERY HELP!!!
Date: Mon, 03 Mar 2003 13:41:23 +0100
Message-ID: <3E634D73.6010702@klaster.net> (raw)
References: <hOednbvBOI8QG_yjXTWcqQ@giganews.com>

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





view thread (6+ messages)  latest in thread

Message-ID: <3E634D73.6010702@klaster.net>
Permalink:  ../3E634D73.6010702@klaster.net/
Also on:    postgresql.org/message-id/3E634D73.6010702@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, matt@uberstats.com
  Subject: Re: HardCORE QUERY HELP!!!
  In-Reply-To: <3E634D73.6010702@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox