About 42,400 results
Open links in new tab
  1. How to find max value and its associated field values in SQL?

    Jun 1, 2011 · Here's a way to pull that off without subtables, RANK, etc.. The key is to create and aggregate that combined the key and value from the detailed table and then just max on that and substring out the value you want.

  2. SQL - How to find the highest number in a column?

    Oct 10, 2009 · If you want to select the entire row then use a query like this: select c1.* from customer c1, (select max(id) as max_id from customer )c2 where c1.id=c2.max_id c2 is an alias for the new temporary table which contains max id. Then its cross product is taken with customer table to get the entire row.

  3. SQL MIN() and MAX() Functions - W3Schools

    The SQL MIN() and MAX() Functions. The MIN() function returns the smallest value of the selected column. The MAX() function returns the largest value of the selected column.

  4. sql - Finding maximum value from a table - Stack Overflow

    Mar 10, 2019 · I want to get the maximum value. I have tried this query in SQL: select (select MAX(v) from (values (Value1),(Value2),(Value3)) as value(v)) as Maxvalue from TestValue

  5. SQL MAX() Function - GeeksforGeeks

    Jan 21, 2025 · In this article, we will cover the syntax, use cases, sample tables, and practical examples with detailed explanations of how to use the MAX() function effectively. Whether we are a beginner or an advanced SQL user, this guide will help us understand and apply the MAX() function confidently. Syntax:

  6. How to Find the Maximum Value of a Numeric Column in SQL

    To find the max value of a column, use the MAX() aggregate function; it takes as its argument the name of the column for which you want to find the maximum value. If you have not specified any other columns in the SELECT clause, the maximum will be calculated for all records in the table.

  7. 3 Ways to Select the Row with the Maximum Value in SQL

    Feb 2, 2022 · Here are three examples that use SQL to find and select the row with the maximum value in a given column. The examples work in most major RDBMSs, including MySQL, MariaDB, PostgreSQL, SQLite, Oracle, and SQL Server. Sample Data. We’ll start with the following data: SELECT * FROM PetShow; Result:

  8. SQL Server MAX(): Get Maximum Value in a Column

    In SQL Server, the MAX() function is an aggregate function that returns the maximum value in the column or expression. It is an aggregate function so it canbe used with the GROUP BY clause to find the maximum value in a group. MAX(expression) Parameters. expression: It can be a constant, a table column, or function, and any combination of ...

  9. How to Select Only Rows With Maximum Value in a Column in SQL

    Jun 5, 2024 · One straightforward method to select only rows with the maximum value in a column is utilizing the SQL MAX() function. This aggregate function calculates the maximum value of a specified column across all rows in a table.

  10. How to Select Row With Max Value in SQL Server

    Feb 16, 2024 · In SQL Server, retrieving rows that contain the maximum value for a specific column for each distinct value in another column can be a common and challenging task. This process is done by identifying the maximum value for each group and then selecting the corresponding rows.

Refresh