× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: SQL Pivot
  • From: Klein Ron <ron.klein@xxxxxxxxxx>
  • Date: Thu, 3 Feb 2000 14:15:22 -0600

Dave,
What version of OS are you running.  I tried your pivot SQL on our  box and
it does not like something in the statements you use.  We are on V4R2.
Ron

> -----Original Message-----
> From: Leland, David [SMTP:dleland@Harter.com]
> Sent: Thursday, February 03, 2000 9:01 AM
> To:   'MIDRANGE-L@midrange.com'
> Subject:      RE: SQL Pivot
> 
> Based on info from Pete Hall, I have my SQL "pivot" working and thought
> I'd share it since it looks like something that will come in real handy
> for me.
> 
> The file contains just 3 fields - ITNBR, TDATE (as *DATE data type) and
> QTY.  Following is the SQL statement: 
> 
> select itnbr,                                                       
> decimal(sum(case when month(tdate) = 1 then qty else 0 end),7,0) as Jan, 
> decimal(sum(case when month(tdate) = 2 then qty else 0 end),7,0) as Feb, 
> decimal(sum(case when month(tdate) = 3 then qty else 0 end),7,0) as Mar, 
> decimal(sum(case when month(tdate) = 4 then qty else 0 end),7,0) as Apr, 
> decimal(sum(case when month(tdate) = 5 then qty else 0 end),7,0) as May, 
> decimal(sum(case when month(tdate) = 6 then qty else 0 end),7,0) as Jun, 
> decimal(sum(case when month(tdate) = 7 then qty else 0 end),7,0) as Jul, 
> decimal(sum(case when month(tdate) = 8 then qty else 0 end),7,0) as Aug, 
> decimal(sum(case when month(tdate) = 9 then qty else 0 end),7,0) as Sep, 
> decimal(sum(case when month(tdate) = 10 then qty else 0 end),7,0) as Oct, 
> decimal(sum(case when month(tdate) = 11 then qty else 0 end),7,0) as Nov, 
> decimal(sum(case when month(tdate) = 12 then qty else 0 end),7,0) as Dec 
> from file 
> group by itnbr 
> order by itnbr 
> 
> Dave 
> 
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.