Skip to content
Advertisement

SQL : For each ID, only display the highest value from another column (can’t group by)

I have this table here :

I need to find the current step of each project by searching for the highest idStep of each idProject without using Group By, which is where I’m completely stuck. Without GROUP BY I just cannot get there.

Basically, the output should be this :

I want to use a Query built like this

I know that FOR EACH isn’t SQL, I’m only trying to make my desired query structure readable.

Advertisement

Answer

You want a correlated subuqery:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement