How to get max value of a column based on value of another column?

aldoblack

In my Database I have a table called ARTICLES. In ARTICLES I have 2 columns.

enter image description here enter image description here

Now I want to get the max value of NRRENDORDOK column where the TIP column has value 'A'.

e.g. the max number of cells A in TIP column is 8.

Any help will be appreciated.

Michael Mairegger

You should take use of the MAX function and then GOUP BY tip in order to get the max value for each tip:

SELECT tip, MAX(nrreddordok) FROM table GROUP BY tip

If you just want values for A then you can use following query:

SELECT MAX(nrreddordok) FROM table WHERE tip = 'A'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get value based on max of a different column grouped by another column

From Dev

get max date based on column value

From Dev

Get records based on column max value

From Dev

SQL inner join on a column based on max value from another column

From Dev

get max value of column

From Dev

Get MAX value from one column and MIN from another column

From Dev

Get value of another column based on foreign key

From Dev

How to assign a default value in a column based on another column's value?

From Dev

How to assign a default value in a column based on another column's value?

From Dev

How to assign a value for a column based on another column value in R?

From Dev

How do I return max value in a non-aggregated sql query based on another column value

From Dev

R - How to get value from a column based on value from another column of same row

From Dev

How to get every value from one column to another column based on its corresponding value

From Dev

Finding the max value from a column and populating another column based on the max value

From Dev

updating column value based on another column value

From Dev

How to Get Max Value and Return Other Column

From Dev

How can I get the max value from one column where values match another column?

From Dev

Grouping column indices of an array based on max value of another list in python

From Dev

Grouping column indices of an array based on max value of another list in python

From Dev

get all first occurences of a column based on the value of another column - matlab

From Dev

Value of id corresponding to max value of another column

From Dev

Value of id corresponding to max value of another column

From Dev

Get max value of a column and id

From Dev

Get the max value for a specific column

From Dev

How can I get a list of all permutations of two column combination based on another column's value?

From Dev

How can I get the corresponding value of a column based on an aggregate of another column?

From Dev

How to get all values of a specific column based on a specific value in another column in R?

From Dev

SQL how create a Boolean column based on the value of another column

From Dev

How to find adjacent values in a column based on another column value in Sql

Related Related

  1. 1

    Get value based on max of a different column grouped by another column

  2. 2

    get max date based on column value

  3. 3

    Get records based on column max value

  4. 4

    SQL inner join on a column based on max value from another column

  5. 5

    get max value of column

  6. 6

    Get MAX value from one column and MIN from another column

  7. 7

    Get value of another column based on foreign key

  8. 8

    How to assign a default value in a column based on another column's value?

  9. 9

    How to assign a default value in a column based on another column's value?

  10. 10

    How to assign a value for a column based on another column value in R?

  11. 11

    How do I return max value in a non-aggregated sql query based on another column value

  12. 12

    R - How to get value from a column based on value from another column of same row

  13. 13

    How to get every value from one column to another column based on its corresponding value

  14. 14

    Finding the max value from a column and populating another column based on the max value

  15. 15

    updating column value based on another column value

  16. 16

    How to Get Max Value and Return Other Column

  17. 17

    How can I get the max value from one column where values match another column?

  18. 18

    Grouping column indices of an array based on max value of another list in python

  19. 19

    Grouping column indices of an array based on max value of another list in python

  20. 20

    get all first occurences of a column based on the value of another column - matlab

  21. 21

    Value of id corresponding to max value of another column

  22. 22

    Value of id corresponding to max value of another column

  23. 23

    Get max value of a column and id

  24. 24

    Get the max value for a specific column

  25. 25

    How can I get a list of all permutations of two column combination based on another column's value?

  26. 26

    How can I get the corresponding value of a column based on an aggregate of another column?

  27. 27

    How to get all values of a specific column based on a specific value in another column in R?

  28. 28

    SQL how create a Boolean column based on the value of another column

  29. 29

    How to find adjacent values in a column based on another column value in Sql

HotTag

Archive