With the following code:
a = ['foo', 'bar', 'doh', 'rae']
I'd like the string
SUM(foo) AS foo, SUM(bar) AS bar, SUM(doh) AS doh, SUM(rae) AS rae. This works:
Tried something clever like
'SUM(%s) AS %s' % ([x for x in a], [x for x in a]) but obviously it didn't work, and using two list comprehensions felt woefully inefficient.