Skip to Content

Query to calculate price per liter

Hello

Could you please help me to the query, the list price is not in a number format from the query and I have no result because of the formula in the query to calculate price epr liter

So I need to convert the format of list price in number but I do not know how to write it

Please help thank you

SELECT T0.[ItemCode], T0.[ItemName], T0.[SVolume], T1.[Price], T1.[Currency],(T1.[Price]/t0.[SVolume]) as 'price per Liter' FROM OITM T0 INNER JOIN ITM1 T1 ON T0.ItemCode = T1.ItemCode WHERE T1.[PriceList] =1

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jan 09, 2013 at 03:59 PM

    Hi G. DELANOE

    Try This

    SELECT T0.[ItemCode], T0.[ItemName], T0.[SVolume], T1.[Price], T1.[Currency],(T1.[Price]/t0.[SVolume]) as 'price per Liter' FROM OITM T0 INNER JOIN ITM1 T1 ON T0.ItemCode = T1.ItemCode WHERE T1.[PriceList] = '[%0]'

    Regards

    Kennedy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2013 at 04:14 PM

    Hi....

    Try this...

    SELECT T0.[ItemCode], T0.[ItemName], T0.[SVolume], cast(T1.[Price] as float), T1.[Currency],(cast(T1.[Price] as float)/t0.[SVolume]) as 'price per Liter' FROM OITM T0 INNER JOIN ITM1 T1 ON T0.ItemCode = T1.ItemCode WHERE T1.[PriceList] =1

    Regards,

    Rahul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2013 at 04:25 PM

    Hi,

    Price in price list is always a number. What do you exactly want to display? Post an example.

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi G. DELANOE....

      SELECT T0.[ItemCode], T0.[ItemName], T0.[SVolume], cast(T1.[Price] as float),

      T1.[Currency],

      (CAST(T1.[Price] as FLOAT)/ CAST(T0.[SVolume] as FLOAT) as 'price per Liter'

      FROM OITM T0 INNER JOIN ITM1 T1 ON T0.ItemCode = T1.ItemCode WHERE T1.[PriceList] =1

      Regards

      Kennedy

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2013 at 05:20 PM

    A work around is to times 1000 for this field value before calculation. Then divide the result by 1000.

    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.