I have two tables. One is Vendors and the other PurchaseOrder. They both have a common field VendorId. The VendorID in the Vendor table is unique, but there can be many instances of the same VendorID in the PurchaseOrder table. I need to return all the fields of each Vendor (only once) that has a matching entry in the PurchaseOrder table. The PurchaseOrder fields are not important.
My sql is "SELECT * FROM Vendors inner JOIN PurchaseOrder ON Vendors.VendorId = PurchaseOrder.VendorId Where Printed = True AND Cleared = False ORDER By VendorName" which will return all the fields of both tables for each entry that is in the purchaseorder table.
I've looked at Distinct ,but I cannot get all the required fields needed. Any ideas for the correct sql?
David Paulson
My sql is "SELECT * FROM Vendors inner JOIN PurchaseOrder ON Vendors.VendorId = PurchaseOrder.VendorId Where Printed = True AND Cleared = False ORDER By VendorName" which will return all the fields of both tables for each entry that is in the purchaseorder table.
I've looked at Distinct ,but I cannot get all the required fields needed. Any ideas for the correct sql?
David Paulson