简体   繁体   中英

MySQL Left join with Like condition like this

select user_ip  from affi
left join cc on affi.user_ip on  "%cc.auth_ip%" 

Now the ip field in CC table looks like this : 11.11.11.11:2312 and on Affi table it looks like 11.11.11.11 this.

any ideas? :) thanks in advance

Try this

SELECT
    user_ip
FROM
    affi
LEFT JOIN
    cc
ON
    affi.user_ip LIKE concat(cc.auth_ip,'%')

you also could try to use substr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM