Skip to content

Instantly share code, notes, and snippets.

Dhany sdynamo

Block or report user

Report or block sdynamo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sdynamo
sdynamo / gist:cc4e921184d53c62c1d9e2848157f7bd
Created Jun 20, 2017
Custom SQL to select and delete duplicate listing for Sabai Directory plugin. Based on address AND phone number.
View gist:cc4e921184d53c62c1d9e2848157f7bd
-- Select query
SELECT pst.`post_id`, pst.`post_title`, pst.`post_slug`
FROM (
SELECT min(pst.`post_id`) AS `min_id`, dst.`post_title`, cnt.`phone`, loc.`address`, loc.`street`, loc.`city`, loc.`state`, loc.`zip`, loc.`country`, COUNT(*) AS `cnt`
FROM (SELECT DISTINCT `post_title`
FROM `tableprefix_sabai_content_post`
WHERE `post_entity_bundle_type` = 'directory_listing' AND
`post_slug` REGEXP '[[:digit:]]') dst JOIN `tableprefix_sabai_content_post` pst
ON dst.`post_title` = pst.`post_title`
JOIN `tableprefix_sabai_entity_field_directory_contact` cnt
You can’t perform that action at this time.