How can I get only 10 records from a table where there are more than 1000 records. I have a test table with rowid, name, cost.
select name, cost from test;
here I want to select only first 10 rows and dont want to select rowid.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To select the first ten records you can use LIMIT followed by the number of records you need:
To select ten records from a specific location, you can use LIMIT 10, 100
This will display records 101-110
This will display records 11-111
To make sure you retrieve the correct results, make sure you ORDER BY the results too, otherwise the returned rows may be random-ish
You can read more @ http://php.about.com/od/mysqlcommands/g/Limit_sql.htm