1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| select src.name as name
, src.email as email
, src.address as address
, src.phone as phone
, crs.name as name_corresp
, crs.email as email_corresp
, crs.address as addresse_corresp
, crs.phone as phone_corresp
, 'email' as correspondance
from data src
inner join
data crs
on src.name > crs.name
and src.phone > crs.phone
and src.address > crs.address
and src.email = crs.email
union
select src.name as name
, src.email as email
, src.address as address
, src.phone as phone
, crs.name as name_corresp
, crs.email as email_corresp
, crs.address as addresse_corresp
, crs.phone as phone_corresp
, 'addresse' as correspondance
from data src
inner join
data crs
on src.name > crs.name
and src.phone > crs.phone
and src.email > crs.email
and src.address = crs.address
union
select src.name as name
, src.email as email
, src.address as address
, src.phone as phone
, crs.name as name_corresp
, crs.email as email_corresp
, crs.address as addresse_corresp
, crs.phone as phone_corresp
, 'Phone' as correspondance
from data src
inner join
data crs
on src.name > crs.name
and src.phone > crs.phone
and src.address > crs.address
and src.phone = crs.phone LIMIT 0, 250 |
Partager