Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6175797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:59:11+00:00 2026-05-23T23:59:11+00:00

Suppose I have a SQL database in which a column could look something like

  • 0

Suppose I have a SQL database in which a column could look something like this

Numbers
-------
1
1
2
3
4
4

Is it possible to create a single SQL query that simply grabs the largest number, which in this case would be 4? Or would I have to query every single number, put them in some sort of list in an external program, and write an algorithm to find the largest one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:59:11+00:00Added an answer on May 23, 2026 at 11:59 pm

    Use can use the MAX Aggregate function. Since your table only has one column it would look like

    SELECT MAX(NUMBERS) n from yourtable
    

    depending on your backend you could also put into a variable. For example in SQL Server

    Declare @TheMax int
    SELECT @TheMax = MAX(NUMBERS) 
    FROM yourTable
    

    Here’s a working example on data.stackexchange.com

    If you also wanted the Max Per somthing you’d need a group by

    For example this query on Data.SE gives the max score per tag

    SELECT 
          tagname, max(score) 
    FROM 
       posts p
       INNER JOIN postTags pt
       ON p.id = pt.postId
       INNER JOIN tags t
       ON pt.tagid = t.id 
    GROUP BY 
       tagname ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a string 'nvarchar(50)', which is for example the T-SQL string segment
Suppose I have a big database, about 800 tables. In this database there is
Okay, I have a SQL 2005 database with a stored PDF. The column uses
I have a simple application which stores the data into the sql server database
I have a column in Datablase Table, Suppose its Observation which contains three types
Suppose I have a PL/SQL stored procedure as follows: PROCEDURE do_something(foo VARCHAR2 DEFAULT NULL)
Suppose you have a table in SQL: Prices ------ 13.99 14.00 52.00 52.00 52.00
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new
Suppose I have two queries on a database table. The queries are defined in
I have an application running in IIS which connects to a SQL Server 2008

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.