Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select with join
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

alex weber
Starting Member

4 Posts

Posted - 06/21/2010 :  05:53:24  Show Profile  Reply with Quote
hi all,
i have a doubt regarding a select operation performed on two tables with join statement.
The table structure is as follows
table name- application
---------------------- ------------------------------------------
appid appname version
1 Test 10
2 Test 11
3 Sample 5

table name- app_users

app_users_id user_id appid version date_downloaded

Now i want a grid which should show data like this

AppName LastDownloadedVersion Date_Downloaded

Here the value for appname should be created by appname+'V'+latest version of that appname(eg. Application name- Test Ltest version- 11 thus appname becomes 'TestV11')

Could anybody help me to solve this problem..
Thanx in advance..

Edited by - alex weber on 07/19/2010 14:36:30

Posting Yak Master

102 Posts

Posted - 06/21/2010 :  06:42:27  Show Profile  Visit Devart's Homepage  Reply with Quote
Hi,for MS SQL Server 2005 or higher try it:

select appname,version,date_download
row_number() over(partition by au.appid order by au.date_download desc) as last_id,
a.appname+'V'+au.version as appname,
from app_users au
inner join [application] a
on au.appid=a.appid
) s

Tools for SQL Server
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000