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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select with join

Author  Topic 

ratheeshsql
Starting Member

17 Posts

Posted - 2007-01-29 : 06:33:44
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
------------------------------------------------------------
1 250 1 10 1/29/2007




Now i want a grid which should show data like this

AppName LastDownloadedVersion Date_Downloaded
----------------------------------------------------------
TestV11 10 1/30/2007
SampleV5 -- ------


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..

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-29 : 07:04:25
[code]select a.appname + 'v' + cast(a.version as varchar) + ' ' + cast(au.version as varchar) + convert(varchar, au.date_downloaded, 101)
from application as a
left join app_users as au on au.appid = a.appid[/code]


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -