Jira JQL doesn't not provide this out of the box, however there are many add-ons that extend JQL to allow this.
I would normally suggest you install the Script Runner add-on (see https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner) as it contains many useful built-in functions to perform searches in JQL like the one you are asking about.
The particular function for this add-o you want to use is:
parentsOf(Subquery) - Returns the parents of issues specified by the subquery.
issueFunction in parentsOf("labels in (needDesign)")
Unfortunately you stated you are using ondemand and this add-on is not available for ondemand currently.
Your options as far as I see is to:
- code a function using the REST API (requires programming skills search for subtasks then get the parent id)
- periodically review the ondemand add-ons in the Jira marketplace for updated add-ons that extend JQL (I didn't seen any that do what you need)
- contact the Script Runner add-on owner and/or Jira and request this functionality.
This type of subquery is so fundamental for anyone using subtasks I am surprised that there isn't a bundled solution for this, perhaps it is a potential performance issue for the ondemand offering.
I know that is not what you want to hear but hope that answers your question.