So I have a table with name, quantity and price
name quantity price "custom-row"
a 12 5 12*5
b 20 3 20*3
c 18 10 18*10
Is it possible to add a "custom" row when using a select query? And I want the values in that row = quantity * price. How can I do that?
CodePudding user response:
select name, quantity, price, (quantity * price) as custom_row
from table_name
you can just multiply your columns by column name and after AS
sign any column name you want
CodePudding user response:
try this:
select name, quantity, price, quantity * price as custom-row
from table_name
you can where if needed filtering