Hey everyone,I recently switched over to MS SQL 2008 from Excel. I need to start managing large data sets using SQL because it's much quicker. Right now, I am importing the data from a CSV file into a table. This generates the table I need. I am now trying to perform calculations on this data, similar to what I had done in Excel. How can I get this to work:SELECT clothing, price, amount, CASEWHEN price = 0THEN 0WHEN price <> 0THEN CASE WHEN amount > 20 THEN 200 ELSE 0 ENDEND AS 'buyprice'FROM clothingWHERE designer LIKE 'calvin klein'GO
I need to reference 'buyprice' later for calculation of another variable. How do I do this? Do I need another select statement? Do I assign it to a variable? I have tried a bunch of things and I can't get it to work. This is for a very large set of data.Thanks for any help.