Thanks is helps.. I was able to change a few other scripts to use this so I dont have to query using each record in code to get the Vendor name, Saves me some time and resourses.
Main Topics
Browse All TopicsI have a query for our Progress database what I use a DSN from a .net program to get the dataset. I use brio explorer create the queries.
I need to add a table to the query but as you can see in the below, I need to use cross joins to get the data. the table I need to add may not have a record for the product. I need a blank or null returned.
The query is
SELECT AL1.cono, AL4.programid, AL1.whse, AL4.programty, AL5.name as WhseName, AL3.descrip as Description, AL1.prod, AL1.binloc1 as Binloc,
AL6.lastrcptdt as MainLastrcptdt, AL6.usagerate as Mainusagerate, AL6.leadtmavg as MainLeadtMavg, AL6.qtyonorder as MainQtyOnOrder,
AL6.class as MainClass, AL6.linept as MainMax, AL6.orderpt as MainMin, AL1.statustype, AL6.arpVendNo as VendNo, AL3.UnitSell as UnitSellSize,
AL5.Custno, AL4.Shipto,AL1.lastinvdt, AL1.arpwhse,AL6.Statustype
AL1.qtyreservd, AL1.qtyonhand, AL6.lastinvdt as MainLastInvDt, AL1.linept as remoteMax, AL1.orderpt as remoteMin,
AL1.enterdt, AL1.user2 as SpotBuyFl, AL1.usagerate, AL2.normusage, AL1.qtyonorder, AL3.unitcnt, AL1.lastrcptdt,
AL7.normusage as MainNormusage, AL6.avgcost as MAINavgcost, AL6.user6 as MainLotQty, AL8.name as VendName
FROM PUB.icsw AL1, PUB.icswu AL2, PUB.icsp AL3, PUB.zzmtsicsd AL4, PUB.icsd AL5, PUB.icsw AL6, PUB.icswu AL7, PUB.apsv AL8
WHERE (AL1.cono=AL2.cono AND
AL1.whse=AL2.whse AND
AL3.cono=AL1.cono AND
AL3.prod=AL1.prod AND
AL1.prod=AL2.prod AND
AL1.cono=AL4.cono AND
AL1.whse=AL4.whse AND
AL1.cono=AL5.cono AND
AL1.whse=AL5.whse AND
AL6.cono=AL1.cono AND
AL1.arpwhse=AL6.whse AND
AL1.prod=AL6.prod AND
AL7.cono=AL1.cono AND
AL7.prod=AL1.prod AND
AL7.whse=AL1.arpwhse AND
AL8.cono=AL6.cono AND
AL8.vendno=AL6.arpVendNo) AND
(AL1.cono=1 AND AL4.programid='ATK'
((NOT AL1.statustype='x') OR (AL1.statustype='x' AND AL1.qtyonhand > 0)) )
I need to add the PUB.zzplan table. It attaches to the PUB.icsw AL1 table
AL1.cono=PUB.zzplan.cono
AL1.whse=PUB.zzplan.Rwhse
AL1.prod=PUB.zzplan.prod
to return PUB.zzplan.partclass.
I need it to return all the records that is in the icsw table and return a null/blank for the partclass if there is no record.
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: qayinPosted on 2009-10-01 at 12:33:41ID: 25472346
Hi,
as MainStatusType,AL1.user6 as LotQty, AL1.avgcost,
as MainStatusType,AL1.user6 as LotQty, AL1.avgcost,
THis can be accomplished using left joins:
SELECT AL1.cono, AL4.programid, AL1.whse, AL4.programty, AL5.name as WhseName, AL3.descrip as Description, AL1.prod, AL1.binloc1 as Binloc,
AL6.lastrcptdt as MainLastrcptdt, AL6.usagerate as Mainusagerate, AL6.leadtmavg as MainLeadtMavg, AL6.qtyonorder as MainQtyOnOrder,
AL6.class as MainClass, AL6.linept as MainMax, AL6.orderpt as MainMin, AL1.statustype, AL6.arpVendNo as VendNo, AL3.UnitSell as UnitSellSize,
AL5.Custno, AL4.Shipto,AL1.lastinvdt, AL1.arpwhse,AL6.Statustype
AL1.qtyreservd, AL1.qtyonhand, AL6.lastinvdt as MainLastInvDt, AL1.linept as remoteMax, AL1.orderpt as remoteMin,
AL1.enterdt, AL1.user2 as SpotBuyFl, AL1.usagerate, AL2.normusage, AL1.qtyonorder, AL3.unitcnt, AL1.lastrcptdt,
AL7.normusage as MainNormusage, AL6.avgcost as MAINavgcost, AL6.user6 as MainLotQty, AL8.name as VendName
FROM PUB.icsw AL1
left join PUB.icswu AL2
on AL1.cono=AL2.cono
and AL1.whse=AL2.whse
and AL1.prod=AL2.prod
left join PUB.icsp AL3
on AL3.cono=AL1.cono
and AL3.prod=AL1.prod
left join PUB.zzmtsicsd AL4
on AL1.cono=AL4.cono
and AL1.whse=AL4.whse
and AL4.programid='ATK'
left join PUB.icsd AL5
on AL1.cono=AL5.cono
and AL1.whse=AL5.whse
left join PUB.icsw AL6
on AL6.cono=AL1.cono
and AL1.arpwhse=AL6.whse
and AL1.prod=AL6.prod
left join PUB.icswu AL7
on AL7.cono=AL1.cono
and AL7.prod=AL1.prod
and AL7.whse=AL1.arpwhse
left join PUB.apsv AL8
on AL8.cono=AL6.cono
and AL8.vendno=AL6.arpVendNo
WHERE AL1.cono=1
AND ((NOT AL1.statustype='x') OR (AL1.statustype='x' AND AL1.qtyonhand > 0))
----------
when you add the PUB.zzplan table the query looks like this:
SELECT AL1.cono, AL4.programid, AL1.whse, AL4.programty, AL5.name as WhseName, AL3.descrip as Description, AL1.prod, AL1.binloc1 as Binloc,
AL6.lastrcptdt as MainLastrcptdt, AL6.usagerate as Mainusagerate, AL6.leadtmavg as MainLeadtMavg, AL6.qtyonorder as MainQtyOnOrder,
AL6.class as MainClass, AL6.linept as MainMax, AL6.orderpt as MainMin, AL1.statustype, AL6.arpVendNo as VendNo, AL3.UnitSell as UnitSellSize,
AL5.Custno, AL4.Shipto,AL1.lastinvdt, AL1.arpwhse,AL6.Statustype
AL1.qtyreservd, AL1.qtyonhand, AL6.lastinvdt as MainLastInvDt, AL1.linept as remoteMax, AL1.orderpt as remoteMin,
AL1.enterdt, AL1.user2 as SpotBuyFl, AL1.usagerate, AL2.normusage, AL1.qtyonorder, AL3.unitcnt, AL1.lastrcptdt,
AL7.normusage as MainNormusage, AL6.avgcost as MAINavgcost, AL6.user6 as MainLotQty, AL8.name as VendName
FROM PUB.icsw AL1
left join PUB.icswu AL2
on AL1.cono=AL2.cono
and AL1.whse=AL2.whse
and AL1.prod=AL2.prod
left join PUB.icsp AL3
on AL3.cono=AL1.cono
and AL3.prod=AL1.prod
left join PUB.zzmtsicsd AL4
on AL1.cono=AL4.cono
and AL1.whse=AL4.whse
and AL4.programid='ATK'
left join PUB.icsd AL5
on AL1.cono=AL5.cono
and AL1.whse=AL5.whse
left join PUB.icsw AL6
on AL6.cono=AL1.cono
and AL1.arpwhse=AL6.whse
and AL1.prod=AL6.prod
left join PUB.icswu AL7
on AL7.cono=AL1.cono
and AL7.prod=AL1.prod
and AL7.whse=AL1.arpwhse
left join PUB.apsv AL8
on AL8.cono=AL6.cono
and AL8.vendno=AL6.arpVendNo
left join PUB.zzplan AL9
on AL1.cono=AL9.cono
and AL1.whse=AL9.Rwhse
and AL1.prod=AL9.prod
WHERE AL1.cono=1
AND ((NOT AL1.statustype='x') OR (AL1.statustype='x' AND AL1.qtyonhand > 0))
let me know if this helps.