Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
select StockReqTemp.SRT_ID,StockReqTemp.SRT_Descr,StockReqTemp.SRT_Qty,StockReqTemp.SRT_Unit,StockReqTemp.SRT_Conv,StockReqTemp.SRT_Price,(StockReqTemp.SRT_Qty * SRT_Price) as StockReqTemp.SRT_TAmt,StockReqTemp.SRT_ServedQty,ItemMasterlistTable.Item_Balance
from StockReqTemp
inner join ItemMasterlistTable
on StockReqTemp.SRT_ID = ItemMasterlistTable.Item_ID


I'm trying to figure out how to insert a multiplication in my sql query since I need it. Any idea on a modification on my query perhaps?

What I have tried:

I'm doing a trial and error in a my sql server. When I remove the formula it works but I can't get a value for my SRT_TAmt(Total Amount).
Posted
Updated 18-Jun-18 19:29pm

1 solution

You have syntax error
SQL
SELECT 
    StockReqTemp.SRT_ID
  , StockReqTemp.SRT_Descr
  , StockReqTemp.SRT_Qty
  , StockReqTemp.SRT_Unit
  , StockReqTemp.SRT_Conv
  , StockReqTemp.SRT_Price
-- old code ( StockReqTemp.SRT_Qty * SRT_Price ) as StockReqTemp.SRT_TAmt
-- SRT_price belongs to StockReqTemp, i am guessing. may be you should mention that too as StockReqTemp.SRT_Price
  , ( StockReqTemp.SRT_Qty * SRT_Price ) AS SRT_TAmt
  , StockReqTemp.SRT_ServedQty
  , ItemMasterlistTable.Item_Balance
FROM StockReqTemp
INNER JOIN ItemMasterlistTable ON StockReqTemp.SRT_ID = ItemMasterlistTable.Item_ID
 
Share this answer
 
v3
Comments
[no name] 19-Jun-18 1:34am    
My bad. I forgot to put a StockReqTemp. on SRT_Price. It was originally there but the red line(error) still doesn't disappear. I tried removing the StockReqTemp. on SRT_TAmt and it worked. Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900