Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



how to display only 4 records from a table based on a condition for ex i have a table called pr..

Answer / roger

LIMIT 0,4 will return 5 records because it starts with 0.
It should be LIMIT 0,3

SELECT prodid, prodname FROM products limit 0,3

Is This Answer Correct ?    16 Yes 6 No

how to display only 4 records from a table based on a condition for ex i have a table called pr..

Answer / vigneshram

select nid, prodname from products limit 0,4

Is This Answer Correct ?    8 Yes 3 No

how to display only 4 records from a table based on a condition for ex i have a table called pr..

Answer / surya prakash

SELECT prodid, prodname FROM products limit 4;

Is This Answer Correct ?    5 Yes 1 No

how to display only 4 records from a table based on a condition for ex i have a table called pr..

Answer / anil alpati

No need to adding offset value. since your question says starting from first 4 records

Below is my query -
select nid, prodname from products limit 4

Is This Answer Correct ?    1 Yes 0 No

how to display only 4 records from a table based on a condition for ex i have a table called pr..

Answer / 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

how to display only 4 records from a table based on a condition for ex i have a table called pr..

Answer / cherry-mae

algorithm

An algorithm (pronounced AL-go-rith-um) is a procedure or
formula for solving a problem. The word derives from the
name of the mathematician, Mohammed ibn-Musa al-Khwarizmi,
who was part of the royal court in Baghdad and who lived
from about 780 to 850. Al-Khwarizmi's work is the likely
source for the word algebra as well.

A computer program can be viewed as an elaborate algorithm.
In mathematics and computer science, an algorithm usually
means a small procedure that solves a recurrent problem.

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More MySQL Interview Questions

How can you calculate the sum of any column of a table?

0 Answers  


What are the technical specifications of mysql?

0 Answers  


Have you ever used MySQL Administrator and MySQL Query Browser? Describe the tasks you accomplished with these tools?

1 Answers   TCS,


How to create trigger in mysql phpmyadmin?

0 Answers  


Is the syntax correct? Explain the meaning of the syntax given below: $dbc = mysqli_connect('data.aliensabductedme.com', 'owen', 'aliensrool', 'aliendatabase');

0 Answers  


What do you need to connect php to mysql?

0 Answers  


How to determine the location of the data directory?

0 Answers  


What is pragma autonomous_transaction?

0 Answers  


What is localhost in mysql?

0 Answers  


Which is better mysql or mssql?

0 Answers  


How many rows can be inserted in mysql at a time?

0 Answers  


What is the function of myisamchk?

0 Answers  


Categories