Last active
August 29, 2015 14:24
-
-
Save bunnywong/ed27baeaab308914a4e7 to your computer and use it in GitHub Desktop.
TODO: Fix unique address not as default
This file contains 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 | |
oc_customer.email AS 'email', | |
oc_customer.customer_id AS 'customer_cid', | |
oc_customer.address_id AS 'customer_addressId', | |
oc_address.customer_id AS 'address_cid', | |
oc_address.address_id AS 'address_addressId', | |
COUNT(oc_address.customer_id) as 'address_count' | |
FROM | |
oc_customer, oc_address | |
WHERE | |
( | |
oc_address.customer_id = oc_customer.customer_id | |
AND | |
oc_address.address_id <> oc_customer.address_id | |
-- && oc_customer.email = '[email protected]' -- DEBUG | |
) | |
GROUP BY | |
oc_address.customer_id | |
HAVING (address_count = 1) | |
ORDER BY | |
'customer_cid' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment