Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
moiseszaragoza
Starting Member
8 Posts |
Posted - 2008-11-11 : 13:06:03
|
| I am having problems with a Select Top Query can some 1 tell me what i am doing wrong Select * FROM Video WHERE UserID = '1' " This returns all recors for that userID Select TOP 3 * FROM Video WHERE UserID = '1'This returns nothing at all Just keep smiling |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-11-11 : 13:07:58
|
| no order by |
 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-11-11 : 13:27:33
|
| SELECT TOP(3) * FROM VIDEO WHERE USERID ='1' |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-11 : 13:39:53
|
quote: Originally posted by lionofdezert SELECT TOP(3) * FROM VIDEO WHERE USERID ='1'
What is the difference from original one? |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-11-11 : 13:56:38
|
| Your syntax is fine. Are you sure that the only difference in the queries is the "TOP 3"? |
 |
|
|
moiseszaragoza
Starting Member
8 Posts |
Posted - 2008-11-11 : 15:04:43
|
| that is the only thing i have been chaning but i cant get that to work for now i build a counter and and i am telling it not to do anything after the forst 3 records are posted. i know that this is not the best way as the DB will still have to process all records Just keep smiling |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-11 : 22:55:06
|
| selecting top x records without any order by clause doesnt make sense. it just returns you 3 random rows. |
 |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-11-12 : 00:29:31
|
| HI your query is right..I think problem will be a silly mistake. pls once more check ur 2 queries..ok tanx,.. |
 |
|
|
|
|
|