× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



A view defines what fields are usable. You're trying to create a view
without RID, but then reference that field in your view. You will get the
results you want, by adding RID to the view, and to the GROUP BY. Then,
when you reference the view, select where RID='XXXX' as you normally
would, and you'll only see grouped results based on the value you're
asking for.



___________________________________
Darren Strong
Dekko





From: "Art Tostaine, Jr." <atostaine@xxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Date: 08/30/2018 12:06 PM
Subject: SQL View question
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



I have a SQL Statement in an RPG Program that uses fields that aren't in
the group by as selections. Something like this where field RID is used
to
select.

When I try to create it as a view I can't access RID.

RPG SQL:
select :ls.shp, ls.sea, ls.sty, ls.clr,
ls.fab, ls.mod, ls.msz,
sum(ls.qty), sum(ls.qty)
from locsku00 ls
where ls.rid=:invrid
group by
ls.shp,
ls.sea, ls.sty, ls.clr,
ls.fab, ls.mod, ls.msz;

Create View
create view InvPhy (shp,sea,sty,clr,fab,mod,msz,qty) as
(SELECT ls.shp,ls.sea,ls.sty,ls.clr,ls.fab,ls.mod,ls.msz,SUM(ls.qty)
FROM invdta.locsku00 as ls
GROUP BY ls.shp,ls.sea,ls.sty, ls.clr,ls.fab, ls.mod, ls.msz);

Try to use the View
select * from INVPHY where rid = 81251501 and shp=50875 and sty=
'J4LW2700' order by shp,sea,sty,clr,fab,mod,msz

[SQL0206] Column or global variable RID not found. [SQL State=42703, DB
Errorcode=-206]

Can I use a view for this?

Thanks, Art

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.