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

Help on query

Hi Experts,

I got this query from the forum which is very helpful to me, however, I want to insert the Item Description during execution.

SELECT T0.ItemCode, T0.[ItemName] (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 4) AS 'Vendor Price List 1',

(SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 5) AS 'Vendor Price List 2', (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 6) AS 'Vendor Price List 3'

FROM dbo.OITM T0

WHERE T0.ItemCode between '[%0]%' and '[%1]%'

Thanks,

Don

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2010 at 12:23 PM

    Hi Don,

    Try this.

    SELECT T0.ItemCode, T0.ItemName, 
    (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 4) AS 'Vendor Price List 1',
    (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 5) AS 'Vendor Price List 2', 
    (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 6) AS 'Vendor Price List 3'
    FROM DBO.OITM T0
    WHERE T0.ItemCode >= '[%0]' AND T0.ItemCode <= '[%1]'
    

    Regards,

    Madhan.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2010 at 10:25 AM
    SELECT T0.ItemCode, T0.ItemName (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 4) AS 'Vendor Price List 1',
    (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 5) AS 'Vendor Price List 2', (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 6) AS 'Vendor Price List 3'
    
    FROM dbo.OITM T0
    WHERE T0.ItemCode between '[%0]' and '[%1]' and
    T0.ItemName between '[%2]' and '[%3]'
    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Don,

      IF you want to print the Last Buy Price, Try this Query Report.

      SELECT T0.ItemCode, T0.ItemName, T0.LastPurPrc AS 'Last Purchase Price',
      (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 4) AS 'Vendor Price List 1',
      (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 5) AS 'Vendor Price List 2', 
      (SELECT Price FROM ITM1 WHERE ItemCode = T0.ItemCode AND PriceList = 6) AS 'Vendor Price List 3'
      FROM DBO.OITM T0
      WHERE T0.ItemCode BETWEEN '[%0]' AND '[%1]'
      

      Regards,

      Madhan.

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.