Link to home
Start Free TrialLog in
Avatar of Vaibhav Goel
Vaibhav GoelFlag for India

asked on

My Query is not giving correct result. Please help

Hi,

I am trying to find Min value. But my query is not giving correct result.


SELECT MIN(col1)
FROM tablename
GROUP BY col1


Please help.
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ryan Chong
tried this?

SELECT col1, MIN(col1) as minValue
FROM tablename
GROUP BY col1

Open in new window

let us know what you trying to get here. alternatively provide some sample data and the expected result.
If you do not include a GROUP BY clause you will get the min value for the whole column (you can only get one row).

If you DO include a GROUP BY clause you will get the min value for each GROUP BY (so you can get multiple rows)
Try
SELECT MIN(col1)
FROM tablename

Open in new window

Avatar of Vaibhav Goel

ASKER

Thanks guys for helping.