'Check order by, group by so that atleast one column is selected and does not have subquery'

def validate_order_by_and_group_by(self, parameters):

    if (not parameters):
        return
    _lower = parameters.lower()
    if ((u'select' in _lower) and (u'    from    ' in _lower)):
        frappe.throw(_(u'Cannot    use    sub-query    in    order    by'))
    for field in parameters.split(u','):
        if ((u'.' in field) and field.strip().startswith(u'`tab')):
            tbl = field.strip().split(u'.')[0]
            if (tbl not in self.tables):
                if tbl.startswith(u'`'):
                    tbl = tbl[4:(-1)]
                frappe.throw(_(u'Please    select    atleast    1    column    from    {0}    to    sort/group').format(tbl))
