473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Highest value from a column

Hi

I need assistance. I have a column which can have random length but I need to find the highest value in this column. e.g. the Column could contain ABC1234 and ABC125 and I need to find the MAX value in this column which in this case would be ABC1234. I have tried the MAX(column_table) but it was returning ABC125 as the highest value (I am guessing it was adding a zero to the end).

Would someone be able to point me in the direction of finding a solution to this problem?

Thank you for your time. please let me know if you have any questions.
Feb 8 '12 #1
3 2390
Newface
16
Select top 1 [column_table]
from [table_name]
group by [column_table]
order by [max(len([column_table]))] desc



Note:Please use Rownum in place of top if using oracle after where clause.
Feb 8 '12 #2
Rabbit
12,516 Expert Mod 8TB
Define max. Z0 is bigger than all the ones in your example if you're looking at ASCII value. AAAAAAAAAA0000000 is bigger if you're looking at length. Without a clear definition, we can't help you.
Feb 8 '12 #3
It turned out the query was returning me the correct result - it was a join which was being used at a later stage in the query which was causing the issue.

Apologies for wasting your time - this is the joy of working with code that has no comments or documentation anywhere in it.

Thank you very much for your replies and help
Feb 9 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: shank | last post by:
How do you return the highest value in a recordset of maybe 100 records? Is it necessary to run 2 recordsets? I was hoping it was as simple as Max(), but no luck. thanks
2
by: Dirtyweeker | last post by:
Hi, I have a database which records fitness test results of pupils. There are the usual name fields and then a series of fields holding results, e.g. field BP1 and field BP2; each of these...
6
by: Ada | last post by:
hello folks, is there a way to retrieve the highest value in the ArrayList? let say i have a value in the array: {1, 4, 15, 3, 7} it should return a value 15 as the result. i've looked at...
7
by: Jan | last post by:
Hi there, Is there a fast way to get the highest value from an array? I've got the array strStorage(intCounter) I tried something but it all and's to nothing If someone good helpme, TIA
3
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i have an int array and was just wondering if there is a way to get the highest value in the array? for instance, int myValues = new int { 0, 1, 2 } highest value is 2. thanks,
1
by: Coll | last post by:
Hi - I'm trying to figure out how to append a record to a table and then open a form and display that record. My thought was to use the autonum primary key field (recordnum) and display the highest...
5
by: konaravikumar | last post by:
writing a query to get the second highest value in atable by using select statement
9
daniel aristidou
by: daniel aristidou | last post by:
I have a database i use to file. when i insert a new record i want it to imediately insert the next value (file number).the problem is the value is acording to subject. eg Subject1 has a record...
9
by: supun24 | last post by:
Hi.. I have tried following coding to get highest value. EX: If I type 4.341111111111, It should get the value 4.35. If I type 9.132222, It should be 9.14 not 9.13. ...
5
by: taurus89 | last post by:
hello!!! i have five txt file in one folder(cat2t.txt,cat9t.txt,cat6t.txt,cat43t.txt,cat19t.txt) and i need to extract data from this file without insert manually... so how to find top five...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.