Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.oracle    |    Overblown overpriced overengineered SHIT    |    2,288 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 1,527 of 2,288    |
|    Bent Stigsen to Prabu Krishnan    |
|    Re: Help Need for a Query    |
|    25 Jun 04 13:49:16    |
      From: ngcdo@thevoid.dk              Prabu Krishnan wrote:       [snip]       > I need the Result as the following By a Single SQL Query       >       >       > EID ENAME       > ------ ----------       > 1001 John       > 1004 DO       > 1002 Gokul       > 1005 DO       > 1003 Daniel       > 1006 DO              This should get you started, but you should rewrite it so it used outer       joins on subselects of the emp table, because the below sql would be       painfully slow.              select        e.eid,        (select case when min(eid)=e.eid then ename else 'DO' end from emp       where ename=e.ename group by ename) ename       from emp e       order by (select min(eid) from emp where ename=e.ename group by ename),       e.eid                     /Bent              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca