Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
ASP SELECT TOP problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
dnk2001



Joined: 14 Jun 2005
Posts: 81
Location: Zagreb

PostPosted: 26.02.2009 17:25    Post subject: ASP SELECT TOP problem Add user to your forum ignore list Reply with quote

Kada netko na stranici klikne na vijest u bazu (access) se upiše klik i povećeva se za 1 u polju Rank. Napravio sam da mi na stranici prikaže TOP 5 najčitanijih prema tom ranku. Ali to neradi baš kako treba.

Rank polje je Number (long integer), kod koji ja imam je:

Code:
SELECT TOP 5 * FROM Vijesti ORDER BY Rank DESC


Sa tim mi pokazuje sve vjesti koje imaju Rank veći od 0.. Kakako da mi prikaže samo 5 sa najvećim Rankom?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sphx



Joined: 02 Jun 2004
Posts: 109
Location: Split

PostPosted: 26.02.2009 18:01    Post subject: Add user to your forum ignore list Reply with quote

tvoj upit je vezan uz SQL a ne ASP.

Code:
SELECT  * FROM Vijesti ORDER BY Rank DESC LIMIT 5
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
dnk2001



Joined: 14 Jun 2005
Posts: 81
Location: Zagreb

PostPosted: 26.02.2009 20:24    Post subject: Add user to your forum ignore list Reply with quote

da moja greška za ASP..

Sa ovim LIMIT mi javlja grešku

Code:
Syntax error in ORDER BY clause


u pitanju je Access baza
Back to top
View user's profile Send private message Send e-mail Visit poster's website
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 26.02.2009 20:30    Post subject: Add user to your forum ignore list Reply with quote

Možda ti je Rank specijalna riječ probaj

SELECT TOP 5 * FROM Vijesti ORDER BY Vijesti.Rank DESC

ili SELECT TOP 5 * FROM Vijesti ORDER BY [Rank] DESC

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
dnk2001



Joined: 14 Jun 2005
Posts: 81
Location: Zagreb

PostPosted: 27.02.2009 11:35    Post subject: Add user to your forum ignore list Reply with quote

nažalost ni jedan primjer ne funkcionira.. ako netko ima drugu ideju bio bih zahvalan.

probao sam promjenit i naziv tom polju, ali ista stvar.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ghosap



Joined: 18 Sep 2003
Posts: 79

PostPosted: 27.02.2009 12:42    Post subject: Add user to your forum ignore list Reply with quote

ako me dobro sjećanje služi, nemozes koristit top * nego mora bit top ime_polja, dalje_polje itd ...
znaci npr:
Code:
SELECT TOP 5 Rank, Id FROM Vijesti ORDER BY Rank DESC

_________________
. . . and when the balance is lost all that is left is the reckening . . .
Back to top
View user's profile Send private message
dnk2001



Joined: 14 Jun 2005
Posts: 81
Location: Zagreb

PostPosted: 27.02.2009 14:18    Post subject: Add user to your forum ignore list Reply with quote

hm.. izgleda da sad radi.. iako malo čudno, al dobro.. ako mu stavim TOP 5 onda mi prikaže 6, ako je TOP 1 onda prikaže 2.. uglavnom nije bitno, mogu stavit 4 pa dobijem 5.. Very Happy

hvala svima na pomoći.. Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group