hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : does mysql 4.0 support this...
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

does mysql 4.0 support this...

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 05-28-2004, 12:17 AM
cis4life cis4life is offline
Junior Guru Wannabe
 
Join Date: Apr 2003
Posts: 55

does mysql 4.0 support this...


Im just getting started with MySql (was using MS SQL) but this is a budget project we are working on so MySql will be used.

My question is...
Does MySql 4.0 support statements like Select Top 5.... ?
I heard 3.0 didn't so thats why Im asking...

Thanks,
Cedric

Reply With Quote


Sponsored Links
  #2  
Old 05-28-2004, 01:19 AM
luki luki is offline
Web Hosting Master
 
Join Date: Apr 2003
Location: Los Angeles, CA
Posts: 723
Not sure what you mean by "top 5" by you certainly can sort by any column with ORDER BY and/or get a range of records with LIMIT.

__________________
Pings <1 ms, Unlimited Transfer, Lowest Price: http://localhost/

Reply With Quote
  #3  
Old 05-28-2004, 01:31 AM
cis4life cis4life is offline
Junior Guru Wannabe
 
Join Date: Apr 2003
Posts: 55
This is what i mean...
"Select Top 5 ID, news_date, title from news_db order by news_date desc"

This is the sql statement that will return the top 5 rows from the return set.

Do MySql 4.0 support this statment?

Cedric

Reply With Quote
Sponsored Links
  #4  
Old 05-28-2004, 03:51 AM
Loon Loon is online now
Community Liaison
 
Join Date: Apr 2003
Location: London, UK
Posts: 2,975
Yes, you can use the LIMIT clause, see here for info: http://dev.mysql.com/doc/mysql/en/SELECT.html

basically, you would have something like:

Code:
SELECT id,news_date,title FROM news ORDER BY news_date DESC LIMIT 5

Reply With Quote
  #5  
Old 05-28-2004, 04:25 PM
cis4life cis4life is offline
Junior Guru Wannabe
 
Join Date: Apr 2003
Posts: 55
Thanks,

That will work,

Cedric

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Joomla Releases Version 2.5 With SQL Server Support Web Hosting News 2012-01-24 13:34:24
Web Host Rackspace Launches Private Beta for MySQL Cloud Database Web Hosting News 2011-12-01 21:09:51
Web Hosting Software Firm CloudLinux Releases CloudLinux OS Version 6.1 Web Hosting News 2011-09-13 14:08:49
Web Host FireHost Partners with Cloud Security Firm Gazzang for Data Encryption Web Hosting News 2011-08-16 20:33:43
Gazzang Data Encrytion Solution Adds Support for CloudLinux Platform Web Hosting News 2011-06-30 18:54:10


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?