So I have this sub query:*(select p.value1 From Params as p where p.PAR_Field = 'Taxe' and p.PAR_KEY = 'TVA')*And I was using it 3 times to get the same value.In this SELECT statement:Select a, b, c, d,       price *(select p.value1 From Params as p where p.PAR_Field = 'Taxe' and p.PAR_KEY = 'TVA')/100 as RealTVA,       price+price*(select p.value1 From Params as p where p.PAR_Field = 'Taxe' and p.PAR_KEY = 'TVA')/100 as RealPuTTc,       Qte*(price+price*(select p.value1 From Params as p where p.PAR_Field = 'Taxe' and p.PAR_KEY = 'TVA')/100 As RealPtTTC,       price*(select p.value1 From Params as p where p.PAR_Field = 'Taxe' and p.PAR_KEY = 'TVA')/100 as RealTVAFrom  myTable            left outer join myTable2                  on mt_Key = Mt2_mt_keyI would like to take the sub query out, to make the code sexier. I was planning to use a CTE(because im tired), but now I dont see how. If you have any idea, please tell me.Is there a better way? in a select context // in a Create view context? 
Calculating price with a sub query
sql;sql server;t sql
You have the same column twice, I think I would start there in your quest to make your SQL sexier (I probably wouldn't use that term in a professional environment [i.e. interviews]). price*(select p.value1 From Params as p where p.PAR_Field = 'Taxe' and p.PAR_KEY = 'TVA')/100 as RealTVAInstead of using a CTE you probably want to create a variable and assign the single value to the variable and then use the variable in the queryI would also suggest using more parentheses in order to assure that you are performing the mathematical operations in the correct order.I made some assumptions in placing these ParenthesesDECLARE @Tax AS INTEGERSET @Tax = SELECT p.value1 FROM Params AS p WHERE p.PAR_Field = 'Taxe' AND p.PAR_KEY = 'TVA'SELECT a    , b    , c    , d    , price * (@Tax / 100) AS RealTVA    , price + (price * (@Tax / 100)) AS RealPuTTc    , Qte * (price + (price * (@Tax / 100)) AS RealPtTTCFROM  myTable    LEFT OUTER JOIN myTable2        ON mt_Key = Mt2_mt_keyI also used capital letters for the SQL Keywords, a lot of developers use Capital Case, but a lot don't, this is preference.I also gave your operators some space so that I could see what was going on there.Your naming makes it seem as though this is example code or that you are changing the names to protect the innocent.  the only names that look real are one that are not obvious what they mean, that is not good for reading your code later, long names are not always bad.