Get in the habit of using AS, especially in summations.
select count(*) as TheCount...
This will rename your fields (excuse me, columns).
Might want to try it in a view that the users use to make the selection
For example, instead of telling the users to join this file to this and
this and that for a Query/400 query then just create this
CREATE VIEW QTEMP/OPENORDERS AS (
SELECT HCUST AS CUSTNBR,
HORD AS ORDERNBR,
HCPO AS CUSTPONBR,
LLINE AS ORDERLINE,
LPROD AS ITEMNBR,
LCLAS AS ITEMCLASS,
LQORD - LQSHP AS QTYLEFT,
NUMTODATE(LRDTE) AS DATEREQSTD,
WHEN 'E' THEN 'DESC1'
WHEN 'I' THEN 'DESC2'
WHEN 'P' THEN 'DESC3'
END AS LINESTATUS,
LDESC AS ORDLINDESC,
CNME AS CUSTNAME,
CSAL AS SLSMANNBR
LEFT OUTER JOIN GDIDIVF/ECL ON HORD=LORD
LEFT OUTER JOIN GDIDIVF/RCM ON HCUST=CCUST
This thread ...
RE: Referencing columns in temporary tables using SQL, (continued)
This mailing list archive is Copyright 1997-2019 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