Created
July 30, 2018 21:57
-
-
Save kmddevdani/70e0ffbf309e9135cb49f19e31c51825 to your computer and use it in GitHub Desktop.
magento2 find customers with at least 3 addresses, at least one of which is without city
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
count(*) addresses, | |
ce.entity_id, | |
from customer_address_entity cae | |
join customer_entity ce ON cae.parent_id = ce.entity_id | |
where ce.is_active = 1 | |
and cae.city = '' | |
group by ce.entity_id | |
having addresses > 2 -- delete this line, if you also want to show customers that have only one address | |
order by ce.entity_id asc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment