MySqlTalk.com  

Go Back   MySqlTalk.com > MySQL > SQL syntax
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread
Old 01-18-2005, 12:32 AM   #1
Azkaban
Senior Member
 
Join Date: Jul 2004
Posts: 167 Azkaban is on a distinguished road
How do you pull every 40th record out of a table?

I'd like to ORDER BY the primary key, so this shouldn't be that intensive of a query and get every 40th "table.title" out of a database. How do I do it?
Azkaban is offline   Fork this post Reply With Quote
Old 01-18-2005, 04:36 AM   #2
AllenGarner
Junior Member
 
Join Date: Jan 2005
Posts: 8 AllenGarner is on a distinguished road
Re: How do you pull every 40th record out of a table?

have you tried this
SELECT `id`, `title` FROM `table` WHERE `id` % 40 = 0 ORDER BY `primary key`
this will work if you have a auto incremented field for an id
AllenGarner is offline   Fork this post Reply With Quote
Reply


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

Advanced Search

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
1.2.4 How Big MySQL Tables Can Be Administrator Documentation 3 10-21-2004 12:38 AM
How to Insert data in a table by using the max value from the same table.. JsS SQL syntax 6 09-02-2004 04:33 AM
3.3 Creating and Using a Database Administrator Documentation 13 06-09-2004 04:56 PM
1.8 MySQL Standards Compliance Administrator Documentation 21 06-08-2004 03:18 AM
1.6.4 New Features Planned for the Near Future Administrator Documentation 0 06-08-2004 02:47 AM



All times are GMT -4. The time now is 01:31 PM.



Powered by: vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Google
  Web http://www.mysqltalk.com
DISCLAIMERS:
1. We have no commercial interest in this site.
Banner Ads and Subscriptions will only be used to help pay for hosting and maintenance costs.
2. MySQLTalk.com is NOT affiliated with MySQL AB in any way.
3. MySQLTalk.com is NOT endorsed by MySQL AB in any way.
4. Please do not post any content that is harmful to MySQL or MySQL AB, meaning no misleading or obsolete information will be tolerated.
Well-founded constructive criticism meant to help the community is permitted.
5. This website is founded with the goal of improving the MySQL community.
We not only tolerate newbies, we encourage them.
Please do not ask newbies to "read the manual".