TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Martin James
NA
100
15.3k
Why I am not able to use a column alias in WHERE clause?
Mar 26 2021 9:41 AM
I have the following query :
SELECT
ID
,CountEmp
,LAG(CountEmp) OVER (
ORDER
BY
DATE
)
AS
PREV_NUMBER_OF_EMP
,
DATE
FROM
(
SELECT
*
FROM
myTab
WHERE
DATE
>=GETDATE()-90
ORDER
BY
DATE
DESC
)
AS
InnerQuery
WHERE
CountEmp <> PREV_NUMBER_OF_EMP
I am not able to use the PREV_NUMBER_OF_EMP alias.
Reply
Answers (
1
)
String Split in Sql server If your sql Compatibility level Below 130
How to get spare no from categories 1 table where not exist per same s