I don't think the parens are valid with the distinct statement. I'm
pretty sure I was mistaken...


Thanks
Bryce Martin
Programmer/Analyst I
Ext. 4777



Valerie Sheetz <VSheetz@xxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
08/06/2008 10:02 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
"'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: Puzzling SQL Statement






What I meant was like this: SELECT DISTINCT(INVOICE_NUMBER,
CUSTOMER_NUMBER, CUSTOMER_NAME, INVOICE_DATE, INVOICE_AMOUNT) FUND,
DEPARTMENT, ACCOUNT, PROJECT,
JOB FROM INVOICEDETAIL ORDER BY FUND, DEPARTMENT, ACCOUNT, PROJECT,
JOB
I removed the comma after INVOICE_AMOUNT) fund,


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Mike
Sent: Wednesday, August 06, 2008 8:33 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Puzzling SQL Statement

It doesn't seem to like that

SELECT DISTINCT(INVOICE_NUMBER, CUSTOMER_NUMBER, CUSTOMER_NAME,
INVOICE_DATE, INVOICE_AMOUNT), FUND, DEPARTMENT, ACCOUNT, PROJECT,
JOB FROM INVOICEDETAIL ORDER BY FUND, DEPARTMENT, ACCOUNT, PROJECT,
JOB
Token , was not valid. Valid tokens: ).

--
Mike Wills
Midrange Programmer/Analyst

Sick of corporate radio and hungry for something new?
http://thenextgenerationofradio.com
Stalking me? http://twitter.com/MikeWills |
http://friendfeed.com/mikewills


On Wed, Aug 6, 2008 at 7:16 AM, Bryce Martin <BMartin@xxxxxxxxxxxx> wrote:

Try this...

SELECT DISTINCT(INVOICE_NUMBER, CUSTOMER_NUMBER, CUSTOMER_NAME,
INVOICE_DATE, INOICE_AMOUNT), FUND, DEPARTMENT, ACCOUNT, PROJECT, JOB
FROM
INVOICEDETAIL ORDER BY FUND, DEPARTMENT, ACCOUNT, PROJECT, JOB

Basically you just put () around the fields that make the record unique
in
your situation.


Thanks
Bryce Martin
Programmer/Analyst I
Ext. 4777



Mike <koldark@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
08/05/2008 04:01 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
"RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Puzzling SQL Statement






I am working on figuring out a fix for a bug that came up after I added
a
feature the user requested. I don't want duplicate invoices listed, but
they
now are. This is the problem SQL statement.

SELECT DISTINCT INVOICE_NUMBER, CUSTOMER_NUMBER, CUSTOMER_NAME,
INVOICE_DATE, INVOICE_AMOUNT, FUND, DEPARTMENT, ACCOUNT, PROJECT, JOB
FROM
INVOICEDETAIL ORDER BY FUND, DEPARTMENT, ACCOUNT, PROJECT, JOB

I know the problem and why the problem is there (the FUND, DEPARTMENT,
ACCOUNT, PROJECT, JOB is the account number for the item), but my
question
is how can I fix it? I can't remove those fields from the select because
then the ORDER BY doesn't work. Any ideas on how I can pull this query
off?


--
Mike Wills
Midrange Programmer/Analyst

Sick of corporate radio and hungry for something new?
http://thenextgenerationofradio.com
Stalking me? http://twitter.com/MikeWills |
http://friendfeed.com/mikewills
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



--- This message (including any attachments) is intended only for the
use
of the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential,
and
exempt from disclosure under applicable law. If you are not the intended
recipient, you are hereby notified that any use, dissemination,
distribution, or copying of this communication is strictly prohibited.
If
you have received this communication in error, please notify us and
destroy
this message immediately. ---
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


This thread ...

Replies:

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

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 [javascript protected email address].