Jump to content

How To Only Display Max Value?


tomas.hortlax
 Share

Recommended Posts

Hi Please forgive me. I'm new in this. This problem I have may be very easy to resolve.But I can't. And forgive my bad english. I have a database with many values. My problem is that I just want to display the max value of two different values. (of many more)Like this exempel. I have three column name. A, B and CA is only textA B CAB 1 1CD 1 2EF 2 1GH 2 2IJ 2 3KL 3 1MN 1 3I want to display value A of every B value with max value of C.Like this...MN (B=1 and max C=3)IJ (B=2 and max C=3)KL (B=3 and max C=1)We begin with that problem. Later I want to calculate some other values.../ThanksTomas

Link to comment
Share on other sites

I'm not sure if this solves your problem, but you can order by the columns and just select the top few rows. e.g.:SELECT A FROM table ORDER BY C DESC, B DESC LIMIT 3
There is a problem. ( I think)I dont know what the user will do with the databas.There is no limit in the values. But they will allways increase with 1.Thers is a serie like thisB=1 and C will increase with one, and I dont know when it stopBut B can have changed many times (always increased with 1) before C change when B=1.I dont know if you understand. My english is not so good./Tomas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...