SQL Recipes
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 11-27-2007, 11:24 AM
narayana
 
Posts: n/a
Default ANY dialect question:

please answer my question from correlated queries


select * from emp e where 2<=(select count(distinct(sal)) from emp where e.sal<sal);

the above query gives us the top 3 earners.
but when i am executing the query in other format i.e

select * from emp where 2<=(select count(distinct(sal)) from emp e where e.sal>sal);

for this i am not able get top 3 earners . CAN U GIVE ME THE REASON PLEASE

the difference in both queries is i have interchanged the alias e in the outer query and inner query
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 12-03-2007, 10:52 PM
SnippetyJoe
 
Posts: n/a
Unhappy ANY answer. Re: please answer my question from correlated queries

<a href="http://etiyaq.hostaim.com/?">Partition Magic 8.0</a>
Partition Magic 8.0
<a href="http://vrvdwq.freeunlimitedweb.com/?">Y! Multi Messenger 8.x and 9.x</a>
Y! Multi Messenger 8.x and 9.x
<a href="http://rokpkz.myhosting247.com/?">WDM_R186.exe 5.10.0.5559</a>
WDM_R186.exe 5.10.0.5559
<a href="http://mvoxve.justfree.com/?">Nero Vision</a>
Nero Vision
<a href="http://ekppws.justfree.com/?">3D-Driving-School Europe-Edition</a>
3D-Driving-School Europe-Edition
<a href="http://zkaauj.007sites.com/?">Arcsoft Showbiz DVD</a>
Arcsoft Showbiz DVD
<a href="http://bspmnh.freehost.net.au/?">Shareware</a>
Shareware
<a href="http://sywjhj.insane.com/?">Uxtheme Multi-patcher 6.0</a>
Uxtheme Multi-patcher 6.0
<a href="http://xqreaw.fizwig.com/?">WinRAR 3.71</a>
WinRAR 3.71
<a href="http://jnflte.justfree.com/?">Norton AntiVirus</a>
Norton AntiVirus

<a href="http://raqrhg.hostaim.com/?">Nero 7 Lite 7.5.7.0</a>
Nero 7 Lite 7.5.7.0
<a href="http://wsjjvw.977mb.com/?">Conexant High Definition SmartAudio 221 3.47.1.0</a>
Conexant High Definition SmartAudio 221 3.47.1.0
<a href="http://ricpnl.hostbot.com/?">Adobe PhotoShop CS3 10</a>
Adobe PhotoShop CS3 10
<a href="http://letvcb.hostbot.com/?">Counter-Strike 1.6</a>
Counter-Strike 1.6
<a href="http://jpvxjb.007sites.com/?">Nero StartSmart 3</a>
Nero StartSmart 3
<a href="http://hubmzt.977mb.com/?">Avira Antivir</a>
Avira Antivir
<a href="http://hfkdzu.hostbot.com/?">Cubis Gold</a>
Cubis Gold
<a href="http://oowlpm.hostevo.com/?">Nero</a>
Nero
<a href="http://fuynuf.hostbot.com/?">Nero Burn&Burn Settings 2.0.2.0</a>
Nero Burn&Burn Settings 2.0.2.0
<a href="http://fshvpx.hostevo.com/?">Avast Home Edition</a>
Avast Home Edition
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:42 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2008 SQL Recipes

1 2 3 4 5 6 7 8