|
Thank you for your reply Alan.npdnpd,
Would you be able to share an example as i have not used CTE's
Thanks
From: "Alan Campin" <alan0307d@xxxxxxxxx>
To: "Midrange Systems Technical Discussion"
<midrange-l@xxxxxxxxxxxxxxxxxx>
Date: 28/02/2021 12:47 PM
Subject: Re: SQL - Using result fields in a calculation
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>
Why not use CTE's. Much simpler code.
On Sat, Feb 27, 2021, 6:33 PM Don Brown via MIDRANGE-L <
midrange-l@xxxxxxxxxxxxxxxxxx> wrote:
Hi,
I have the following SQL
select npdsdt, npdedt, npdamt, npdsts, npdtno, npdabl, npdnph,
ntrttynphnab,
(select sum(ntramt) from dktntrpf where ntrnpd = 3913 and
=ntrtty
'UDD') as amount,
(select sum(ntramt) from dktntrpf where ntrnpd = 3913 and
=taken
'ADJ') as adjust,
npdamt + adjust - amount as avail
from dktnphpf, dktnpdpf
where nphcoy = 1 and nphnab = 'ND0001' and nphnph = npdnph;
I am running it in iACS
It fails indicating the variable "adjust" is not found.
I am obviously not using the correct terms when searching google as I
can't find an example of how to use the results or a sub select.
Any assistance would be appreciated.
Thanks
Don
--
This email has been scanned for computer viruses. Although MSD has
usereasonable precautions to ensure no viruses are present in this email,MSD
cannot accept responsibility for any loss or damage arising from the
ofhttps://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_midrange-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=20L2tP8BR3TTjEzg0c10Ad7jQh76XEcpmWmubrBNofM&e=
this email or attachments..list
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_midrange-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=BzwQ8Z6zZDW1xi6KgosG7vR8JYWfOC8x9M1FgI--nMQ&e=
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
.related
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
https://urldefense.proofpoint.com/v2/url?u=http-3A__midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=Mqos72GpQZwTS914dlmKpQuemp8aUx6AAI_uo8tCAgI&e=questions.
Help support
by shopping athttps://urldefense.proofpoint.com/v2/url?u=http-3A__amazon.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=xQQhRc_hC0zHQcwu9-Yf7G-N9YQK00p02ySMwIttDWQ&e=
with our affiliatehttps://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=WG23P3IU834Gq8DyPUYVwnt-1cduIhrj4kSbr1oYO88&e=
link:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_midrange-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=20L2tP8BR3TTjEzg0c10Ad7jQh76XEcpmWmubrBNofM&e=
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_midrange-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=BzwQ8Z6zZDW1xi6KgosG7vR8JYWfOC8x9M1FgI--nMQ&e=
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
.https://urldefense.proofpoint.com/v2/url?u=http-3A__midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=Mqos72GpQZwTS914dlmKpQuemp8aUx6AAI_uo8tCAgI&e=
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support
by shopping athttps://urldefense.proofpoint.com/v2/url?u=http-3A__amazon.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=xQQhRc_hC0zHQcwu9-Yf7G-N9YQK00p02ySMwIttDWQ&e=
with our affiliate link:https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=Ujx-rkrGSO55h_jypQFfIiHaHA5RwcjZpDDGKfQVwCc&s=WG23P3IU834Gq8DyPUYVwnt-1cduIhrj4kSbr1oYO88&e=
MSD
--
This email has been scanned for computer viruses. Although MSD has taken
reasonable precautions to ensure no viruses are present in this email,
cannot accept responsibility for any loss or damage arising from the useof
this email or attachments..list
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxhttps://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_midrange-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=eXIxBbr3VqJD3wCezEK_IfTQDOF3eRXaDnDWsBJLHnI&s=KvPxmIbyDLIvOeqwhQyme0J7algFXmWnw_-FLwin_Uw&e=
To subscribe, unsubscribe, or change list options,
visit:
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxxhttps://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_midrange-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=eXIxBbr3VqJD3wCezEK_IfTQDOF3eRXaDnDWsBJLHnI&s=jHqnFTbGo8l_F3OmT1dUdRCehaBRsJtpVhqpl8DCdQc&e=
Before posting, please take a moment to review the archives
at
https://urldefense.proofpoint.com/v2/url?u=http-3A__midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=eXIxBbr3VqJD3wCezEK_IfTQDOF3eRXaDnDWsBJLHnI&s=GtT9cT344QFoTUiQEn1NHW5Pfea29C16ibaly0NopVE&e=
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support
link:https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=Kys-lxRCMpPr7up01Pp1FRjOe49ne6imWwi1b-ue8yQ&m=eXIxBbr3VqJD3wCezEK_IfTQDOF3eRXaDnDWsBJLHnI&s=U5GboQ7eE7fQbfH6RJdz3v-e8GdsCTUS6wXY6KPzr5w&e=
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.