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

Union All with %1 & %2

Hi,

The folowing query is used to extract data from JE & AP however, when I add one more statement Where T2.U_description2 like '[%1]' at the end, then it doesn't work:

Select T0.objtype, T0.RefDate, T0.TransId, T0.Line_ID, T0.Account, T0.U_Description1, T0.Debit, T0.Credit from JDT1 T0

Where T0.Transtype='30' and T0.U_description1 like '[%1]'

Union All

Select T2.objtype, T2.DocDate, T2.DocEntry, T2.LineNum, T2.AcctCode, T2.U_description2, T2.LineTotal, Null from PCH1 T2

Where T2.U_description2 like '[%1]'

do you know why?

Thanks.

Jack

Edited by: Raymond Chan on Aug 5, 2008 3:58 AM

Edited by: Raymond Chan on Aug 5, 2008 4:01 AM

Edited by: Raymond Chan on Aug 5, 2008 4:01 AM

Edited by: Raymond Chan on Aug 5, 2008 4:04 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 05, 2008 at 02:06 AM

    Is U_description2 a user field that you have created? What is this description field and what are you trying to get as a result?

    Select T0.objtype, T0.RefDate, T0.TransId, T0.Line_ID, T0.Account, T0.U_Description1, T0.Debit, T0.Credit from [dbo\].[JDT1\] T0

    Where T0.Transtype='30' and T0.U_description1 like '[%1\]'

    Union All

    Select T2.objtype, T2.DocDate, T2.DocEntry, T2.LineNum, T2.AcctCode, T2.U_description2, T2.LineTotal, Null from [dbo\].[PCH1\] T2 Where T2.U_description2 like '[%1\]'

    Also use fully qualified table reference like [dbo\].[tablename\]

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi, you solved my problem again. Thanks a lot! It works now.

      Another question is if I want to add AR header and row to the union, how should I do?

      Now it is from JE and AP, then I want to add AR but fields will come from header level and row level, then what should I do?

      Thanks.

      Jack & Raymond

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.