I 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
as MainStatusType,AL1.user6 as LotQty, AL1.avgcost,
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.