Skip to Content
author's profile photo Former Member
Former Member

Outgoing payment

hi All,

I have a query which is repeating data in case multiple checks are used for payment;

SELECT DISTINCT T0.[DocDate], T1.[DueDate], T1.[CheckNum]as 'Cheque', T1.[BankCode] AS 'Bank Code' , T1.[Branch], T1.[AcctNum], T2.[AcctCode],T2.[Descrip], T2.[SumApplied], T0.[DocTotal] FROM OVPM T0 INNER JOIN VPM1 T1 ON T0.DocNum = T1.DocNum INNER JOIN VPM4 T2 ON T0.DocNum = T2.DocNum WHERE T0.[DocType] = 'A' and T0.[DocDate] >=[%0]

AND

T0.[DocDate] <=[%1] and T0.[DocNum] = [%3]

Let's say I selected doc type as accounts and at row level i selected 9 accounts. While on the payment means, i used 9 different checks for the payment. Now while viewing the data from this query, its repeating the data 81 times. How do i get to show only 9 accounts and 9 check number in the query? Please assist.

Thanks,

joseph

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2010 at 08:50 PM

    Hi Joseph,

    Check your query result. For those 81 lines, one or more columns must have different values from each other. You need to omit those columns from your query.

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 04, 2010 at 07:02 PM

    I think your query is correct but for a few small corrections. The query below was test by me and it works. Check it out.

    SELECT DISTINCT T0.DocDate, T1.DueDate, T1.CheckNum as 'Cheque', T1.BankCode AS 'Bank Code', T1.Branch, 
    T1.AcctNum, T2.AcctCode, T2.Descrip, T2.SumApplied, T0.DocTotal 
    FROM [dbo].[OVPM] T0 INNER JOIN [dbo].[VPM1] T1 ON T0.DocNum = T1.DocNum INNER JOIN [dbo].[VPM4] T2 ON T0.DocNum = T2.DocNum 
    WHERE T0.DocType = 'A' AND T0.DocDate BETWEEN '[%0]' AND '[%1]' AND T0.DocNum = '[%2]'

    Regards

    Suda

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 10, 2010 at 10:41 AM

    Closing the thread..

    Thanks,

    Joseph

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.