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
ahmed elbarbary
NA
1.6k
274.6k
How to make group by Revision_ID and when repeated display l
Jan 18 2020 6:17 AM
problem
How to make group by Revision_ID and when repeated display last check date separated by stick | ?
I need to group data by Revision_ID that make count to all zpartid
every revision_ID Have group of parts .
and when revision id repeated two time then lastcheckdate is firstdate | seconddate
and if more than two time then display text multi date
so How to do that please ?
CREATE
TABLE
[Parts].[LifeCycleMaster](
[LifeCycleID] [
bigint
] IDENTITY(1,1)
NOT
FOR
REPLICATION
NOT
NULL
,
[ZPartID] [
bigint
]
NOT
NULL
,
[LastCheckDate] [
date
]
NULL
,
[Revision_ID] [
bigint
]
NULL
,
CONSTRAINT
[PK_LifeCycleMaster_LifeCycleID]
PRIMARY
KEY
CLUSTERED
(
[LifeCycleID]
ASC
)
WITH
(PAD_INDEX =
OFF
, STATISTICS_NORECOMPUTE =
OFF
, IGNORE_DUP_KEY =
OFF
, ALLOW_ROW_LOCKS =
ON
, ALLOW_PAGE_LOCKS =
ON
)
ON
[
PRIMARY
],
CONSTRAINT
[UK_PartID]
UNIQUE
NONCLUSTERED
(
[ZPartID]
ASC
)
WITH
(PAD_INDEX =
OFF
, STATISTICS_NORECOMPUTE =
OFF
, IGNORE_DUP_KEY =
OFF
, ALLOW_ROW_LOCKS =
ON
, ALLOW_PAGE_LOCKS =
ON
)
ON
[
PRIMARY
]
)
ON
[
PRIMARY
]
Revision_ID ZPartID LastCheckDate
12 10 12/12/2015
15 120 12/01/2014
15 130 05/05/2016
20 170 09/03/2013
20 200 09/05/2016
20 300 09/08/2017
FinalResult
Revision_ID CountParts LastCheckDate
12 1 12/12/2015
15 2 05/05/2016 |12/01/2014
20 3 Multi
date
Reply
Answers (
6
)
how to get financial year based on date ?
how to create query based on optional field on temp table ?