Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 12th, 2004, 01:35 PM
mcjimbo mcjimbo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 mcjimbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ASP/MS SQL - Select only the first 3 records using SQL

Hi guys,

I have a basic news system on my site. Anyway I was to display on the 3 most recent threads on the home page. I'm not sure how to do a select is MS SQL do to this?

At the moment I use:

"Select * from news order by articledate"


Which pulls all the news articles. I want to limit it to pull only the 3 latest news articles? Anyone know how to achieve this?

Thanks in advance

James

Reply With Quote
  #2  
Old October 13th, 2004, 02:29 AM
sundher.ganesh sundher.ganesh is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 sundher.ganesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Top 3 *

Did u try using "TOP 3)
try out this

"Select TOP 3 * from news order by articledate"

Quote:
Originally Posted by mcjimbo
Hi guys,

I have a basic news system on my site. Anyway I was to display on the 3 most recent threads on the home page. I'm not sure how to do a select is MS SQL do to this?

At the moment I use:

"Select * from news order by articledate"


Which pulls all the news articles. I want to limit it to pull only the 3 latest news articles? Anyone know how to achieve this?

Thanks in advance

James

Reply With Quote
  #3  
Old October 13th, 2004, 02:30 AM
sundher.ganesh sundher.ganesh is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 sundher.ganesh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
"Select TOP 3 * from news order by articledate"

Reply With Quote
  #4  
Old October 13th, 2004, 08:18 AM
mcjimbo mcjimbo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 mcjimbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by sundher.ganesh
"Select TOP 3 * from news order by articledate"

Thanks that was it!

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > ASP/MS SQL - Select only the first 3 records using SQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway