Skip to content
Advertisement

Getting max value from rows and joining to another table

Sorry if this is being stupid, I am really a newbie trying to nail this.

What I want is

This is what my query looks like, but it gives me multiple rows of results (instead of max) when i do the join

Sub-query works fine, I get the problem on doing th join.

How do I fix this?

Thanks.

I have sql server 2008 R2

Last one is what I missed.

Advertisement

Answer

What you wrote was missing A in the from clause so its not entirely clear where you went wrong but this should work

See it working here

Alternatively you could use rownumber instead

See it working here

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