|
Is the date an actual date field, numeric or alpha? For Date... you can use the YEAR sql bif. For numeric you have to use some mathmatics or move it into a date sql fld using the CHAR function. You can use the SUM function on the columns that you want totaled and then use the SORT BY function to sort by the year variable you create. It is hard to see how you want to do a SUM and a SORT unless you are doing multiple selects and then merging them in to one. SUM creates one value for a column and SORT sorts multiple records sequentially. Maybe a better explanation of what you want is needed. Bryan Merrell -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of steema@xxxxxxxxxxxxx Sent: Thursday, December 22, 2005 8:57 AM To: RPG programming on the AS400 / iSeries Cc: midrange-l@xxxxxxxxxxxx Subject: SQL Newbie question I need to take 2 files, one is the Frieght, and the other is Order detail, which has the real amt paid for frt. To sort by year where the format is mmddyy. I would like to do this in SQL. I am not sure how to flex out the year and sort on it, how to total various warehouses and other codes.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.