# 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

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

10|10000 characters needed characters exceeded

### Related questions

• 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

10|10000 characters needed characters exceeded
• 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

10|10000 characters needed characters exceeded
• 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

10|10000 characters needed characters exceeded
• Kennedy T G. DELANOE

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

• 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.