hankknight
asked on
MySQL: limit results to items with at least one child item
With MySQL, I want to limit results to items with at least one child item.
My table has a column named `ParentID` and I only want results where at least one item uses the item returned as its `ParentID`
My table has a column named `ParentID` and I only want results where at least one item uses the item returned as its `ParentID`
SELECT `Name`,`ID` FROM `File` WHERE `ClassName` = 'Folder' AND (there is at least one `File` with the `ParentID` of this `ID`)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wpcortes, your code works as is.
Open in new window