如何在数据库中显示每列的前两个记录?

问题描述:

Here is the PHP I'm using.

echo "<td class='leftalign'>";
echo "<tr id='centered' >" . $row['Fund_Yield'] . "</td></tr>";
echo "<tr id='centered' >" . $row['Fund_Benchmark_Yield'] . "</tr>";
echo "<tr id='centered' >" . $row['Class_Yield'] . "</tr>";
echo "<tr id='centered' >" . $row['Special_Class_Yield'] . "</tr>";
echo "<tr id='centered' >" . $row['Plus_minus_Benchmark'] . "</tr>";
echo "<tr id='centered' >" . $row['Plus_Minus_Class'] . "</tr>";
echo "<tr id='centered' >" . $row['Plus_Minus_Special_Class'] . "</tr>";
echo "<tr id='centered' >" . $row['Percentile_Class'] . "</tr>";
echo "<tr id='centered' >" . $row['Percentile_Special_Class'] . "</tr>";

echo"</td>";

Each label contain 4 records but I only want to display the first two or whatever I specify.

you would use LIMIT in your query http://php.about.com/od/mysqlcommands/g/Limit_sql.htm