postgresql - How to find minimum values in a column in sql -


if have table this:

id   name   value 1    abc      1 2    def      4 3    ghi      1 4    jkl      2 

how can select new table still has id, name, value ones minimum value.

in example need table back:

1  abc 1 3  ghi 1 

finding values pretty straightforward:

select * yourtable value = (select min(value) yourtable); 

as right syntax putting rows in table, depend on database engine using.


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -