× 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.



Sort of like this?
create table rob.cartonarrangement (
cartonarrangementid integer,
carton varchar(30),
itemnumber varchar(30),
cartonquantity integer
);
drop table rob.cartonarrangement;
insert into rob.cartonarrangement values(1, 'boxA', 'widget1', 3);
insert into rob.cartonarrangement values(1, 'boxA', 'widget2', 1);
insert into rob.cartonarrangement values(1, 'boxA', 'widget3', 1);
insert into rob.cartonarrangement values(2, 'boxB', 'widget2', 1);
insert into rob.cartonarrangement values(2, 'boxB', 'widget3', 1);
create table rob.selection (
itemnumber varchar(30),
cartonquantity integer
);
insert into rob.selection values('widget2', 1);
insert into rob.selection values('widget3', 1);

set schema = 'ROB';

With t1 as (
select cartonarrangementid, count(*) as rowcount
from cartonarrangement
group by cartonarrangementid)
select * from t1;

With t1 as (
select cartonarrangementid, count(*) as rowcount
from cartonarrangement
group by cartonarrangementid),
T2 as (
select count(*) as rowcount
from selection),
T3 as (
select *
from cartonarrangement
where itemnumber concat char(cartonquantity) in (
select itemnumber concat char(cartonquantity) from selection))

select t3.*, b.rowcount, c.rowcount
from t3,
lateral (select t1.rowcount from t1
where t1.cartonarrangementid = t3.cartonarrangementid) b,
lateral (select t2.rowcount from t2) c
where b.rowcount = c.rowcount
;

Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.