SELECT
[EmpNum], [EmpEmergencyContact], [Relation], [PhType], [Phone]
FROM
(SELECT
[EmpNum], [EmpEmergencyContact], [Relation], [PhType], [Phone]
FROM [EMERGENCY_CONTACT])
A simple query where I have a SELECT statement within FROM clause returns an error:
Incorrect syntax near ')'
You need to put an alias on the from statement.
So change this:
FROM [EMERGENCY_CONTACT]
)
To this:
FROM [EMERGENCY_CONTACT]
) AS tbl
Like this:
SELECT [EmpNum], [EmpEmergencyContact], [Relation], [PhType], [Phone]
FROM (
SELECT [EmpNum], [EmpEmergencyContact], [Relation], [PhType], [Phone]
FROM [EMERGENCY_CONTACT]
) AS tbl
Even safer would be to use the alias on the columns like this:
SELECT
tbl.[EmpNum],
tbl.[EmpEmergencyContact],
tbl.[Relation],
tbl.[PhType],
tbl.[Phone]
FROM (
SELECT [EmpNum], [EmpEmergencyContact], [Relation], [PhType], [Phone]
FROM [EMERGENCY_CONTACT]
) AS tbl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With