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
 problem with sql query

Author  Topic 

jimoomba
Yak Posting Veteran

90 Posts

Posted - 2011-12-05 : 04:07:12
Hi All,

Iam having clientlist table which contains clients username and the clientversions details.

Here is the list of Clisntversions of my table:

2.2.0.12
2.2.0.13
2.2.0.16
2.2.0.18
2.3.0.1
2.3.0.2

From the list we can see the maximum version is 2.3.0.2, but when i ran my query iam getting the maximum client version is 2.2.0.18. please find the below query and help me on the same :

select ClientVersion from ClientList where CONVERT(int,REPLACE(ClientVersion,'.','')) = (select distinct
MAX(CONVERT(int,REPLACE(ClientVersion,'.',''))) from ClientList)group by ClientVersion

Thanks,
Ram

rams

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-05 : 04:17:42
[code]SELECT TOP 1 * FROM table
ORDER BY PARSENAME(Clientversions,4)*1 DESC,
PARSENAME(Clientversions,3)*1 DESC,
PARSENAME(Clientversions,2)*1 DESC,
PARSENAME(Clientversions,1)*1 DESC[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jimoomba
Yak Posting Veteran

90 Posts

Posted - 2011-12-05 : 04:23:54
thanks a lot visakh :)it worked for me

rams
Go to Top of Page
   

- Advertisement -