how to display only 4 records from a table based on a
condition
for ex
i have a table called products
in that nid,prodname are fields
i want to display only any 4 records of perticular product
plz tell me

Answer Posted / sql

Definition: Limit is used to limit your MySQL query results
to those that fall within a specified range. You can use it
to show the first X number of results, or to show a range
from X - Y results. It is phrased as Limit X, Y and included
at the end of your query. X is the starting point (remember
the first record is 0) and Y is the duration (how many
records to display).
Also Known As: Range Results
Examples:

SELECT * FROM `your_table` LIMIT 0, 10

This will display the first 10 results from the database.

SELECT * FROM `your_table` LIMIT 5, 5

This will show records 6, 7, 8, 9, and 10

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I drop a database in mysql?

566


What is root password?

477


Describe mysql transaction properties.

525


What is the maximum size of table in mysql?

563


How to change the database engine in mysql?

457






Is mysql case-sensitive?

497


What are the benefits of mysql?

478


Is mysql relational database?

477


How to decrement dates by 1 in mysql?

516


What is delimiter in mysql stored procedure?

487


What are the different types of triggers in mysql?

460


What is the maximum number of columns per table?

490


Does mysql case matter?

497


Can we store pdf files in mysql?

477


How can I create table in mysql?

525