MySQL Forums
Forum List  »  Microsoft SQL Server

convert ms sql query to mysql
Posted by: mehrdad tat
Date: February 24, 2010 09:49AM

hi

1 have a table with this structure and data

ID UserID IP

----------------------------------

1 1 127.0.0.1
2 1 127.0.0.1
3 1 127.0.0.1
4 1 127.0.0.1
5 1 127.0.0.1
6 1 127.0.0.1
7 1 4.2.2.2
8 1 4.2.2.2
9 1 4.2.2.2
10 1 4.2.2.2
11 1 4.2.2.2
12 1 192.168.1.1


1 wrote this query in the Microsoft sql server :

select

distinct UserID ,IP ,

ROUND(COUNT(IP) / cast((select COUNT(userid) from Users) as float) , 2 ) as '%'

from Users

group by UserID , ip ;


and results is :

UserID IP %
----------- -------------------- ----------------------
1 127.0.0.1 0.53
1 192.168.0.1 0.42
1 4.2.2.2 0.05

(3 row(s) affected)


i can`t convert it to mysql query

please help me

Options: ReplyQuote


Subject
Written By
Posted
convert ms sql query to mysql
February 24, 2010 09:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.