[Last Call] Learn how to a build a cloud-first strategyRegister Now


getiing the largest field size

Posted on 2011-04-18
Medium Priority
Last Modified: 2012-05-11
We inherited a webmail program that uses MySQL to hold messages.
No limits were ever established and now I need to find the largest messages so that I can get the database's under control.
Question by:VomSupport
LVL 19

Accepted Solution

Greg Alexander earned 2000 total points
ID: 35420042
Try this statement

SELECT id,CHAR_LENGTH(your_field) as count FROM `your_table`  ORDER BY `count`  DESC limit 1

this will return the record with the largest of the specified field.
LVL 48

Expert Comment

ID: 35420083
If you are only interrested in the maximum use:

select max(length(field)) from table

Author Closing Comment

ID: 35420084

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month18 days, 12 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question