Hi,

I am trying to reuse my column list in my group by clause but some of my 
columns use label() which is causing a sql syntax error because of the 
"column as label" in the group by clause. Is it possible to get the 
group_by to only use the "label" side of a column .

eg. (This doesn't work because of the "labels"
            group_by = [
                service.date,
                service.client_id,
                service_type.type_code,
                service.service_code,
                client.code.label('client_code'),
                client.name.label('client_name'),
                func.coalesce(func.nullif(client_rate.description, ''),  
service_type.description).label('service_description'),
                service.rate_amt
            ]
            columns = group_by[:].extend([
                func.sum(service.quantity).label('quantity'),
                func.sum(service.service_amt).label('service_amt')
            ])
          
        s = select(columns, criteria,
            from_obj=[outerjoin(db.service_table, db.client_rate_table), 
db.job_table, db.client_table, db.service_type_table],
            group_by=group_by,
            order_by=[service.date, client.name, service.service_code]
        )

Many thanks,

Huy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to