On Dec 29, 9:58 am, [EMAIL PROTECTED] wrote: > What about to let SQL to work for you.
The OP is "trying to learn how to make pivot tables from some excel sheets". You had better give him a clue on how to use ODBC on an "excel sheet" :-) [snip] > SELECT > NAME, > sum (AMOUNT) as TOTAL, > sum (case when (TIME_OF_DAY) = 'Morn' then AMOUNT else 0 END) as > MORN, > sum (case when (TIME_OF_DAY) = 'Aft' then AMOUNT else 0 END) as AFT This technique requires advance knowledge of what the column key values are (the hard-coded 'Morn' and 'Aft'). <rant> It is the sort of thing that one sees when %SQL% is the *only* language used to produce end-user reports. Innocuous when there are only 2 possible columns, but bletchworthy when there are more than 20 and the conditions are complex and the whole thing is replicated several times in the %SQL% script because either %SQL% doesn't support temporary procedures/functions or the BOsFH won't permit their use... not in front of the newbies, please! </rant> -- http://mail.python.org/mailman/listinfo/python-list