Andy Davies wrote:
> try:
>
> select v1.iid, ;
> v1.nMatlID, ;
> v1.nVendorID, ;
> d1.nUnitCost, d1.dActive, ;
> v1.cVendorSKU, ;
> lu1.cCompany;
> FROM eiwdb!luMaterialVendors v1 ;
> JOIN eiwdb!luCompanies lu1 ;
> ON lu1.iid = v1.nMatlID ;
> join (select iid, nunitcost, max(dActive) from eiwdb!luMaterialVendors) d1
> ;
> on v1.iid = d1.iid ;
> WHERE d1.iid = v1.nMatlID AND v1.nMatlID = ?viMatlID ;
> ORDER BY lu1.cCompany
>
>
>   
This worked:

select v1.iid, ;
        v1.nMatlID, ;
        v1.nVendorID, ;
        d1.nUnitCost, ;
        d1.dActive, ;
        lu1.cCompany;
    FROM eiwdb!luMaterialVendors v1 ;
        JOIN eiwdb!luCompanies lu1 ;
            ON lu1.iid = v1.nMatlID ;
        JOIN ;
    (SELECT iid, nunitcost, max(dActive) as dActive;
    FROM eiwdb!luMaterialVendors ;
    GROUP BY 1, 2) d1 ;
            ON v1.iid = d1.iid ;
    WHERE d1.iid = v1.nMatlID ;
        AND v1.nMatlID = ?viMatlID ;
    ORDER BY lu1.cCompany



-- 
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to