Quantcast
Channel: SQLServerCentral » Reporting Services » Reporting Services » Latest topics
Viewing all articles
Browse latest Browse all 2791

Duplicating Property Value

$
0
0
Hello, I have the below query which pulls invoice data based on posting date and GL parameters. I am having the issue where some invoices have multiple posting dates so they are being duplicated. How do I get my query to only pull the oldest posting date so some lines are not duplicated?SELECT uvDocumentTypeAPInvoices.DocumentId ,uvPropertyValueInvoiceDate.PropertyValue AS [uvPropertyValueInvoiceDate PropertyValue] ,uvPropertyValueVendorID.PropertyValue AS [uvPropertyValueVendorID PropertyValue] ,uvPropertyValueVendorName.PropertyValue AS [uvPropertyValueVendorName PropertyValue] ,uvPropertyValueGLAccount.PropertyValue AS [uvPropertyValueGLAccount PropertyValue] ,uvPropertyValueGLAmount.PropertyValue AS [uvPropertyValueGLAmount PropertyValue] ,uvPropertyValueGLName.PropertyValue AS [uvPropertyValueGLName PropertyValue] ,uvPropertyValueInvoiceNumber.PropertyValue AS [uvPropertyValueInvoiceNumber PropertyValue] ,uvPropertyValueDivision.PropertyValue AS [uvPropertyValueDivision PropertyValue] ,uvPropertyValuePostingDate.PropertyValue AS [uvPropertyValuePostingDate PropertyValue]FROM uvDocumentTypeAPInvoices INNER JOIN uvPropertyValueInvoiceNumber ON uvDocumentTypeAPInvoices.DocumentId = uvPropertyValueInvoiceNumber.DocumentId INNER JOIN uvPropertyValueInvoiceDate ON uvDocumentTypeAPInvoices.DocumentId = uvPropertyValueInvoiceDate.DocumentId INNER JOIN uvPropertyValueVendorID ON uvDocumentTypeAPInvoices.DocumentId = uvPropertyValueVendorID.DocumentId INNER JOIN uvPropertyValueVendorName ON uvDocumentTypeAPInvoices.DocumentId = uvPropertyValueVendorName.DocumentId INNER JOIN uvPropertyValueGLAccount ON uvDocumentTypeAPInvoices.DocumentId = uvPropertyValueGLAccount.DocumentId INNER JOIN uvPropertyValueGLAmount ON uvPropertyValueGLAccount.DocumentId = uvPropertyValueGLAmount.DocumentId AND uvPropertyValueGLAccount.GroupValue = uvPropertyValueGLAmount.GroupValue INNER JOIN uvPropertyValueGLName ON uvPropertyValueGLAccount.DocumentId = uvPropertyValueGLName.DocumentId AND uvPropertyValueGLAccount.GroupValue = uvPropertyValueGLName.GroupValue LEFT OUTER JOIN uvPropertyValueDivision ON uvDocumentTypeAPInvoices.DocumentId = uvPropertyValueDivision.DocumentId LEFT OUTER JOIN uvPropertyValuePostingDate ON uvDocumentTypeAPInvoices.DocumentId = uvPropertyValuePostingDate.DocumentIdWHERE uvPropertyValuePostingDate.PropertyValue >= @PropertyValue AND uvPropertyValuePostingDate.PropertyValue <= @PropertyValue2 AND uvPropertyValueGLAccount.PropertyValue LIKE @PropertyValue3

Viewing all articles
Browse latest Browse all 2791

Trending Articles