Fairly new to SQL but I have not worked out how to use variables in my queries.
For example I want to reuse this calculated value again and again throughout my query.
How and where do I declare this as a variable to use calcval instead.
calcval= CAST(((dbo.[UK$Sales Line].[Amount]-dbo.[UK$Sales Line].[Unit Cost (LCY)])/dbo.[UK$Sales Line].[Amount])*100 as decimal(10,2) )