cancel
Showing results for 
Search instead for 
Did you mean: 

Query to calculate price per liter

former_member522789
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

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

Thanks,

Gordon

former_member522789
Participant
0 Kudos

Hello

Thnak you for your answer

I think the problem is not about the list price  which is a number correct but the sales volume which is with 3 digits (decimals) and I think the formula is not working because of that

KennedyT21
Active Contributor
0 Kudos

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
0 Kudos

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

KennedyT21
Active Contributor
0 Kudos

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