Re: [SQL] PIVOT of data

2001-03-14 Thread Josh Berkus
Srikanth, Aside from seconding Tim (your database is *not* normalized), the PIVOT function is only available one of 2 ways: SQL-ONLY, FIXED COLUMN: If you know your categories in advance, you can write a complex view using outer joins, sub-selects, and aggregates. Imagine that we know y

Re: [SQL] PIVOT of data

2001-03-14 Thread Tim Perdue
Probably worth noting that this could be normalized into at least 3 tables from what I can tell. Tim On Wed, Mar 14, 2001 at 11:03:01PM +, Oliver Elphick wrote: > Srikanth Rao wrote: > >Hi, > >I have a table like this: > > location| numbrochures | marketing > >-

Re: [SQL] PIVOT of data

2001-03-14 Thread Oliver Elphick
Srikanth Rao wrote: >Hi, >I have a table like this: > location| numbrochures | marketing >---+--+--- > 101 Asheville, NC |4 | NEWS > 101 Asheville, NC |1 | TV > 101 Asheville, NC |

[SQL] PIVOT of data

2001-03-14 Thread Srikanth Rao
Hi, I have a table like this: location| numbrochures | marketing ---+--+--- 101 Asheville, NC |4 | NEWS 101 Asheville, NC |1 | TV 101 Asheville, NC |3 | RADIO 101 Asheville, NC |