Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 4

SELECT * FROM (SELECT FirstName,LastName, EmpID, ROW_Number() OVER (ORDER BY FirstName) AS Position FROM Employee) FROM EmpSort

Bug Catcher 1

Table should be Aliased with AS.

SELECT * FROM (SELECT FirstName,LastName, EmpID, ROW_Number() OVER (ORDER BY FirstName) AS Position FROM Employee) AS EmpSort

Bug Catcher 2
WITH LocList AS (Address, Municipality, Region) (SELECT Street, City, State FROM Location) SELECT * FROM LocList

AS comes after the field selection list.

WITH LocList (Address, Municipality, Region) AS (SELECT City, State FROM Location) SELECT * FROM LocList

Bug Catcher 3
WITH LocList (Address, Municipality, Region) AS (SELECT City, State FROM Location) SELECT * FROM LocList

You must specify the same number of fields in your select list as specified in the column list of the CTE
WITH LocList (Address, Municipality, Region) AS (SELECT Street, City, State FROM Location) SELECT * FROM LocList

Bug Catcher 4
SELECT * FROM [Grant] WHERE EmpID IS NOT NULL COMPUTE SUM AS Amount

The SUM function uses parenthesizes.

SELECT * FROM [Grant] WHERE EmpID IS NOT NULL COMPUTE SUM(Amount)

You might also like