Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Blessed1978
Yak Posting Veteran
97 Posts |
Posted - 2014-11-25 : 18:49:01
|
I HAVE A TABLE WITH 8 COLUMNSID, DESCRIPTION, STATUS_CMA, STATUS_CAP, STATUS_CED, STATUS_CCT, DATE_CMA, DATE_CAP, DATE_CED, DATE_CCTSOMEONE CAN LOGIN AND MAKE CHANGES TO ANY ONE OF THE STATUSES.THERE ARE FOUR DISTINCT DESCRIPTIONS (CMA, CAP, CED, CCT)EXAMPLE THE SAME ID CAN BE IN THE table MULTIPLE TIMESFOR EACH ENTRY. i WOULD LIKE TO PUT EVERYTHING ON ONE LINE INSTEAD OF HAVING THE SAME ID IN 3 OR 4 DIFFERENT ROWSMY FIELDS ARE ID, DESCRIPTION,STATUS_CMA,STATUS_CAP,STATUS_CED, STATUS_CCT , DATE_CMA, DATE_CAP, DATE_CED, DATE_CCTSO I COULD SO I COULD DO A SELECT ID, DESCRIPTION, CASE WHEN DECCRIPTION = 'CMA' THEN STATUS_CMA ,CASE WHEN DECCRIPTION = 'CAP'THEN STATUS_CAP CASE WHEN DECCRIPTION CED THEN STATUS_CCC, CASE WHEN = CCT THEN STATUS_CCT, MAX(DATE_CMA), MAX(DATE_CAP), MAX(DATE_CED), MAX(DATE_CCT)FROM INFORMATION group by SELECT ID, DESCRIPTIONplease assist where you CANHOWEVER I STILL GET 3 ROWS I ONLY WANT ONLY ONE |
|
Muj9
Yak Posting Veteran
75 Posts |
Posted - 2014-11-26 : 05:24:36
|
PLEASE SHOW YOUR CURRENT TABLE RESULT AND YOUR EXPECTED RESULT |
|
|
|
|
|
|
|