wHATS wrong with max function

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
winsonlee
Forum Commoner
Posts: 76
Joined: Thu Dec 11, 2003 8:49 pm

wHATS wrong with max function

Post by winsonlee »

I tried using the following sql statement to get the maximum value from the record. But it doesnt seems to be working.

Code: Select all

$sql= " select MAX(loan_id) from loans";

	$statement = OCIParse($connection, $sql) or die("error in sql statement<br>");
	OCIExecute($statement) or die("error executing sql statement<br>");

		echo OCIResult($statement, 'loan_id');

	OCICommit ($connection);
	OCILogoff($connection);
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you're asking for the wrong column name, I think.. the column name would be 'MAX(loan_id)' I believe..
Post Reply