Hi All,
I am having trouble with an SQL query that I will use to make a Crystal Report. My current query is as follows:
select PONumber.str_val as PONumber, dates.date_val as Date, EQ.str_val as EQNumber, MakeModel.str_val as MakeModel, ProdLineNum.str_val as ProdLineNum, PartOfLine.str_val as PartOfLine, VendorName.str_val as VendorName, Company.str_val as Company, UnitPrice.num_val As UnitPrice, Quantity.num_val as Quantity, Total.num_val as Total, MVPNum.num_val as MVPNum, Requestor.str_val as Requestor from toc inner join propval as PONumber on toc.tocid = PONumber.tocid and PONumber.prop_id = 87 inner join propval as dates on toc.tocid = dates.tocid and dates.prop_id = 5 inner join propval as EQ on toc.tocid = EQ.tocid and EQ.prop_id = 652 inner join propval as MakeModel on toc.tocid = MakeModel.tocid and MakeModel.prop_id = 653 inner join propval as ProdLineNum on toc.tocid = ProdLineNum.tocid and ProdLineNum.prop_id = 654 inner join propval as PartOfLine on toc.tocid = PartOfLine.tocid and PartOfLine.prop_id = 655 inner join propval as VendorName on toc.tocid = VendorName.tocid and VendorName.prop_id = 13 inner join propval as Company on toc.tocid = Company.tocid and Company.prop_id = 15 inner join propval as UnitPrice on toc.tocid = UnitPrice.tocid and UnitPrice.prop_id = 277 inner join propval as Quantity on toc.tocid = Quantity.tocid and Quantity.prop_id = 278 inner join propval as MVPNum on toc.tocid = MVPNum.tocid and MVPNum.prop_id = 295 inner join propval as Requestor on toc.tocid = Requestor.tocid and Requestor.prop_id = 539 inner join propval as Total on toc.tocid = Total.tocid and Total.prop_id = 279
The query is for a purchase order form in which users can select multiple items. The fields that describe the items are Quantity and Unit Price. The issue that I am coming across is that when there are multiple items, the information comes back repeated multiple times with the query I have in place. For instance, if there are 2 items on the purchase order, each item is repeated twice for a total of 4 items. If there are 3 items, each item is repeated 3 times for a total of 9 items.
Does anyone have any suggestions as to how I can change my query to include the items only one time?
Thanks,
Dane