I am trying to group a dataset into 2 sets of data. One which has a certain field asccoiated with and then the rest. In my example below I would like to group all the data into RUs which have a Core centre associated with it and others that do not. I have provided data below.
CREATE TABLE WBU
(
RU varchar(8)
SECTOR varchar(8)
ENT varchar(10)
)
INSERT INTO WBU
SELECT 'RU303100', 'CORE', 'NVR_ENT2_D' UNION ALL
SELECT 'RU303100', 'NONCORE', 'NVR_ENT2_E' UNION ALL
SELECT 'RU303100', 'CORE', 'NVR_ENT4_E' UNION ALL
SELECT 'RU303200', 'NONCORE', 'NVR_ENT3_D' UNION ALL
SELECT 'RU303200', 'NONCORE', 'NVR_ENT4_D' UNION ALL
SELECT 'RU303200', 'CENTER', 'NVR_ENT3_A' UNION ALL
SELECT 'RU303200', 'NONCORE', 'NVR_ENT5_A' UNION ALL
SELECT 'RU303300', 'CORE', 'NVR_ENT6_F' UNION ALL
SELECT 'RU303300', 'CENTER', 'NVR_ENT8_F'
My output here should be
RU303100 CORE NVR_ENT2_D
RU303100 NONCORE NVR_ENT2_E
RU303100 CORE NVR_ENT4_E
RU303300 CORE NVR_ENT6_F
RU303300 CENTER NVR_ENT8_F
and
RU303200 NONCORE NVR_ENT3_D
RU303200 NONCORE NVR_ENT4_D
RU303200 CENTER NVR_ENT3_A
RU303200 NONCORE NVR_ENT5_A