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
Ayesha Fathima
NA
184
29.9k
Use alias column in CONCAT expression
Mar 4 2020 3:18 AM
Hi there,
I'm trying to use alias column in concate expression but it is not allowing me to use directly,I have tried by using some solutions but ended up with some issues.
Can someone please suggest something on this.Here is my simple query.
SELECT
DISTINCT
scm_desc,
CASE
WHEN
email.subject
NOT
LIKE
'%INC00%'
THEN
email.create_date
ELSE
NULL
END
AS
orgdate,
CASE
WHEN
tr_status =
'Closed'
THEN
Concat(
CONVERT
(
VARCHAR
(5),
Datediff(s, orgdate,
tr_modified_on) / 86400)
,
'D'
,
''
+
':'
+
CONVERT
(
VARCHAR
(5), Datediff(s,
orgdate,
tr_modified_on)%86400/3600),
'H'
,
''
+
':'
+
CONVERT
(
VARCHAR
(5), Datediff(s, orgdate,
tr_modified_on)%3600/60),
'M'
)
ELSE
''
END
AS
overdue
FROM
dbo.ims_transaction
LEFT
JOIN
ims_mtr_sub_category
ON
ims_mtr_sub_category.scm_id = ims_transaction.tr_sub_category
LEFT
JOIN
dbo.email
ON
email.incident_no = ims_transaction.tr_incident_no
WHERE
tr_status
NOT
IN
(
'stu_CLS'
)
Reply
Answers (
0
)
Query is not giving correctly result ?
getting count of records