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
> --