Get youngest ID after getting all rows[topic solved]
Posted: Tue Oct 23, 2007 12:22 pm
I have this query:
And it works dandy but I want to change it so that it does something like this.. say theres 3 rows in the database:
Type - ID
Shop - 20
Shop - 13
Shop - 14
What i want my query to do is find the business type which is does.. and get all the rows and then select only the lowest ID out of the 3.
So it would load up Shop - 13 in other words... is this possible?
Code: Select all
$GetBusinessType = mysql_query("SELECT * FROM businesstype
WHERE Businesstypes='$Business'")
or die(mysql_error());
// Fetch the row from the database
if (!($row = mysql_fetch_assoc($GetBusinessType))) {
echo "Business not found!";
echo mysql_error();
}And it works dandy but I want to change it so that it does something like this.. say theres 3 rows in the database:
Type - ID
Shop - 20
Shop - 13
Shop - 14
What i want my query to do is find the business type which is does.. and get all the rows and then select only the lowest ID out of the 3.
So it would load up Shop - 13 in other words... is this possible?