Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / General DB Topics / General DB Topics / October 2004

Tip: Looking for answers? Try searching our database.

ansi 92 sql equivalent to SELECT TOP for mysql?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jimmy Reza de la Turin - 27 Oct 2004 23:06 GMT
simple table
Users with 2 columns
(userId, userInfo)
userId is integer autoincrements.

I want to do a equivalent of select top 3 from users
this works in mssql

SELECT U1.* from users U1,users U2 WHERE U1.userId = U2.userId
AND (3 > (SELECT COUNT(U2.userId) FROM users U2 WHERE (U2.userId < U1.userId)))

but barfs in mysql

need help badly

thanks
jimmy
Dennis Lee Bieber - 28 Oct 2004 04:08 GMT
> simple table
> Users with 2 columns
[quoted text clipped - 3 lines]
> I want to do a equivalent of select top 3 from users
> this works in mssql

    MySQL:

SELECT blah blah blah
WHERE blah blah
LIMIT 3

> ============================================================== <
>   wlfraed@ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
>      wulfraed@dm.net     |       Bestiaria Support Staff       <
> ============================================================== <
>           Home Page: <http://www.dm.net/~wulfraed/>            <
>        Overflow Page: <http://wlfraed.home.netcom.com/>        <
Lennart Jonsson - 28 Oct 2004 04:35 GMT
> simple table
> Users with 2 columns
[quoted text clipped - 10 lines]
>
> need help badly

See:

http://troels.arvin.dk/db/rdbms/#select-limit

HTH
/Lennart

> thanks
> jimmy
> --
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.