こんにちは、私はこの MS SQL スクリプトを素晴らしい MS SQL スキルで作成しましたが、どうすればそれを MySQL で動作させることができますか? 一部の文字列関数で失敗しています :( MySQL をよく知らない!
SELECT i.id as ID, e.code as EMPCODE, lower(e.email_address) as EMAIL
from load_incidents i , dim_employee e
WHERE
( (i.involvedemail = e.email_address)
or (replace(lower(e.preferred_name+e.last_name),' ', '') = replace(lower(i.involvedname),' ', ''))
or (replace(lower(e.preferred_name+e.last_name),' ', '') like replace(lower(i.involvedname),' ', '')+'%')
or (replace(lower(e.first_name+e.last_name),' ', '') = replace(lower(i.involvedname),' ', ''))
or (replace(lower(e.first_name+e.last_name),' ', '') like replace(lower(i.involvedname),' ', '')+'%')
or (replace(lower(e.employee_name),' ','') = replace(lower(i.involvedname),' ',''))
)
and charindex(' ',e.first_name) = 0
and (i.involvedemail= 'none available' or i.involvedemail is null or i.involvedemail = '')
UNION
SELECT i.id as ID, e.code as EMPCODE, lower(e.email_address) as EMAIL
from load_incidents i , dim_employee e
WHERE
( (i.involvedemail = e.email_address)
or (replace(lower(e.preferred_name+e.last_name),' ', '') = replace(lower(i.involvedname),' ', ''))
or (replace(lower(e.preferred_name+e.last_name),' ', '') like replace(lower(i.involvedname),' ', '')+'%')
or (replace(lower(left(e.first_name,charindex(' ',e.first_name)-1) + e.last_name),' ', '') = replace(lower(i.involvedname),' ',''))
or (replace(lower(e.employee_name),' ','') = replace(lower(i.involvedname),' ',''))
)
and charindex(' ',e.first_name) > 1
and (i.involvedemail= 'none available' or i.involvedemail is null or i.involvedemail = '')