View Full Version : Creating vertical rows into horizontal rows
Guest.Visitor
06-22-2005, 09:49 AM
rsj wrote: > Hi All, > I have a file with following fields and data in it What you are wanting to do is really not worth the effort to attempt in the current implementation of SQL/400. It is done much easier in other products such as Excel. Have you tried download the data to the PC? You can directly download the data into Excel's Pivot Table creator and produce very nice output. Bill
coteijgeler@chello.nl
06-23-2005, 12:44 AM
rsj, You have to look into the CASE instruction of SQL. Doing that, to get good result you also should use COALESCE and one of the column FUNCTIONS (SUM,COUNT, MAX, etc.). If the query gets to heavy (performance wise), split the task up in multiple queries. The Reference Manual for V5R1 is at SQL Reference Manual V5R1 (http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm) See posting below, how this can be achieved. Regards, Carel Teijgeler <hr width=50 align=left>Code ('http://www.mcpressonline.com/mc/showcode@@.6b26083b/1')
Guest.Visitor
06-23-2005, 05:06 AM
There's a Crosstab function that will do this included with the book SQL Built-in Functions and Stored Procedures (http://www.mc-store.com/5069.html). Mike
padshore@optonline.net
06-23-2005, 08:06 AM
You may want to look at the following web page http://www.itjungle.com/fhg/fhg052505-story01.html Apparently this will creat a pivot table for you Alan Shore
Guest.Visitor
06-23-2005, 01:45 PM
Hi All, I have a file with following fields and data in it <hr width=50 align=left>Code ('http://www.mcpressonline.com/mc/showcode@@.6b26083b')
Guest.Visitor
06-23-2005, 01:45 PM
Thank you all. I will try to ponder over the suggestions given by everyone. For the time being I wrote an RPG program to do the same as my tyrannical manager wanted it ASAP. Thank you very much for all the inputs given by you all. -rsj
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.