Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > Database & Database Programming

Database & Database Programming MySQL, Oracle, SQL, PL/SQL, ABAP, Smart Forms, and other databases and languages. A database is an organized body of related information used in many websites (including CC).

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-2006, 12:32 PM
NeedHelp NeedHelp is offline
Programming God
 
Join Date: May 2006
Posts: 527
Rep Power: 13
NeedHelp is on a distinguished road
Default Limit number of listings

Is there a way in MySQL to limit how many results are shown?

SELECT * FROM tbl;

but I only want say, 25 results. Is this possible?
__________________
I Need Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-15-2006, 09:26 PM
smith smith is offline
Programmer
 
Join Date: Jun 2006
Posts: 108
Rep Power: 9
smith is on a distinguished road
Default

Yup, just add a LIMIT 0,25

The 0 is where to start and the 25 is the max number of results.
__________________
Code:
for (int i;;) {
   cout << "Smith";
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-15-2006, 09:27 PM
smith smith is offline
Programmer
 
Join Date: Jun 2006
Posts: 108
Rep Power: 9
smith is on a distinguished road
Default

SELECT * FROM tbl LIMIT 0,25;
__________________
Code:
for (int i;;) {
   cout << "Smith";
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-17-2006, 01:17 AM
husky44's Avatar   
husky44 husky44 is offline
Learning Programmer
 
Join Date: Jun 2006
Posts: 30
Rep Power: 9
husky44 is on a distinguished road
Default

I know there is a command for Top 10 or something.. how does that one work?
Sorry to slightly stray here, but it is still kind of relevant.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-17-2006, 08:52 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,224
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

You can do a ORDER BY to get the top ten combined with limit

SELECT * FROM tbl ORDER BY clm_num LIMIT 0,10;

Do to in reverse order do

SELECT * FROM tbl ORDER BY clm_num LIMIT 0,10 DESC; // Descending Order

You can also ORDER by multiple columns in your table

SELECT * FROM tbl ORDER BY clm_num, clm_name LIMIT 0,10;

If the column is character it will be sorted alphabetical.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate the number of pixels in a polygon extreme Java Help 5 04-17-2007 11:34 AM
Number Cloning Ronin Java Help 3 12-21-2006 08:23 AM
I need to generate a random number in PHP dirkfirst PHP Forum 7 07-05-2006 10:58 PM
Number of Lines on a RichText Box Lop Managed C++ 3 06-16-2006 06:19 PM
Number of files and directories in folder dirkfirst PHP Forum 4 05-30-2006 11:06 AM


All times are GMT -5. The time now is 12:13 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads