i have mysql table has following data.
surveyid | staff | username | ipaddress | rating | comments ---------|--------|----------|-----------|---------|---------- 0 | staff1 | user1 | 1.1.1.1 | 10 | none 1 | staff2 | user2 | 1.2.1.1 | 5 | none 2 | staff2 | user3 | 1.2.1.1 | 10 | none 3 | staff2 | user2 | 1.2.1.1 | 6 | none 4 | staff3 | user4 | 1.1.1.51 | 10 | none 5 | staff4 | user3 | 1.21.12.1 | 9 | none 6 | staff5 | user2 | 1.12.1.1 | 10 | none
i wanting query select surveyid, staff, username , ipaddress when ipaddress has been used multiple users same staff.
basicly wanting find out staff has multiple users submit off same ip address.
i have tried following not work.
select * `comment_data` cd inner join (select `ipaddress`, count(distinct `staff`) `comment_data` group `ipaddress` having count(distinct `staff`) > 1 ) usecount on usecount.`ipaddress` = cd.`ipaddress`
i tried following query.
select * `commend_data` `staff`+`ipaddress` in (select `staff`+`ipaddress` `comment_data` group `staff`, `ipaddress` having count(`surveyid`) > 1)
also want make sure display duplicates , don't want display counts.
if need more information please ask.
thanks paul
select surveyid, staff, username, ipaddress table1 ipaddress+staff in ( select ipaddress+staff table1 group ipaddress,staff having count(surveyid)>1 )
Comments
Post a Comment