Created
November 9, 2020 20:00
-
-
Save kitzberger/da147ffdeb2083829e95ea7a099ae267 to your computer and use it in GitHub Desktop.
Update SQL table with count of child elements
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
-- Updates tt_content.tx_mask_items with the number of child elements that refer to this record. | |
UPDATE tt_content parent | |
INNER JOIN (SELECT count(*) as count, tx_mask_items_parent FROM tt_content GROUP BY tx_mask_items_parent) children | |
ON children.tx_mask_items_parent = parent.uid AND parent.CType = 'mask_accordion' | |
SET parent.tx_mask_items=children.count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment