Why is my CASE expression returning an error?

Using the AdventureWorks file I typed the following query: USE AdventureWorks2019 SELECT * CASE WHEN FirstName=’Ken’ THEN 1 ELSE 3 FROM Person.Person But I keep getting the following error: Msg 156, Level 15, State 1, Line 4 Incorrect syntax near the keyword ‘CASE’. Any ideas as to why this is? >Solution : You need a… Read More Why is my CASE expression returning an error?

Trying to show Product Name instead of ID for sales query using Adventure Works database

I am struggling with getting the product name to show instead of the ID. Any thoughts? SELECT TOP 10 ProductID, SUM(LineTotal) AS SumOfSales FROM Sales.SalesOrderDetail AS SOD JOIN Sales.SalesOrderHeader AS SOH ON SOD.SalesOrderID = SOH.SalesOrderID WHERE SOH.OrderDate > ’12/31/2012′ AND SOH.OrderDate < ‘1/1/2014’ GROUP BY ProductID –HAVING SUM(LineTotal) >= 2000000 ORDER BY SUM(LineTotal) DESC >Solution… Read More Trying to show Product Name instead of ID for sales query using Adventure Works database