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