Search Help Board

PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help

C# Help

?Query question
Date:???07-12-03 01:30

I have a query that selects the maximum value in a column:

"select max(columnname) from table where . . . ."

This returns the value in that field. How can I query the database to return all the info in a row with the maximum value in a particular column? I'm sure this is pretty simple, but my eyes are starting to bug out of my head, and I remain a lowly newbie.

?Re: Query question
Date:???07-12-03 07:15

what is the db...some don't certain ways of doing things (like subselects)?

?Re: Query question
Date:???07-12-03 08:50

It's a mysql database.

?Re: Query question
Date:???07-12-03 11:33

select * from table
order by columnname
limit 1

since mysql does not support subselect which would be the easiest way...the above should do what you want...the limit clause keeps the result set to one row


?Re: Query question
Date:???07-13-03 17:43

sorry that sshould be

select * from table
order by columnname desc //keyword to oder from high to low
limit 1

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
New Topic
?Reply To This Message
?Your Name:
?Your Email:
Email replies to this thread, to the address above.

Provided By