|
Sorting is done by ORDER BY clause and in your case, depending on the data type, something like this might work: ORDER BY SUBSTR(CHAR(myDateField),1,2) DESC To do totals you'd use SUM aggregate function. Since you imply that you'll be doing it per warehouse, you may need to group your results based on warehouse: GROUP BY WAREHOUSE With some data samples and a more detailed description of the actual output desired we might be able to give you the actual statement to run. BTW, since you're a newbie let me just say that interactive SQL is good place to start experimenting with SELECT statements. Invoke STRSQL command, type SELECT and hit F4 for prompt and let it guide you rest of the way. Good luck. Elvis -----Original Message----- 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.