December 5, 2015 at 5:54 pm
Current table
ColA ColB ColC
A 1 Yes
A 2 No
A 1 Yes
A 1 Yes
B 1 Yes
B 2 Yes
C 1 Yes
D 1 No
My result should be
A No
B Yes
C No
If ColA Values A,B or C have a No under ColC then result is No else Yes
How can I get this with a SQL query?
Thanks
December 5, 2015 at 6:02 pm
Can you post your DDL and what you've tried so far?
December 5, 2015 at 8:20 pm
smmkr17 (12/5/2015)
Current tableColA ColB ColC
A 1 Yes
A 2 No
A 1 Yes
A 1 Yes
B 1 Yes
B 2 Yes
C 1 Yes
D 1 No
My result should be
A No
B Yes
C No
If ColA Values A,B or C have a No under ColC then result is No else Yes
How can I get this with a SQL query?
Thanks
If those are the only two possible values in ColC, then the solution is easy...
SELECT ColA
,ColC = MIN(ColC)
FROM dbo.SomeTable
GROUP BY ColA
;
--Jeff Moden
Change is inevitable... Change for the better is not.
December 8, 2015 at 10:43 am
smmkr17 (12/5/2015)
Current tableColA ColB ColC
A 1 Yes
A 2 No
A 1 Yes
A 1 Yes
B 1 Yes
B 2 Yes
C 1 Yes
D 1 No
My result should be
A No
B Yes
C No
If ColA Values A,B or C have a No under ColC then result is No else Yes
How can I get this with a SQL query?
Thanks
Given those rules, shouldn't C be a 'yes' ?
December 8, 2015 at 12:10 pm
patrickmcginnis59 10839 (12/8/2015)
smmkr17 (12/5/2015)
Current tableColA ColB ColC
A 1 Yes
A 2 No
A 1 Yes
A 1 Yes
B 1 Yes
B 2 Yes
C 1 Yes
D 1 No
My result should be
A No
B Yes
C No
If ColA Values A,B or C have a No under ColC then result is No else Yes
How can I get this with a SQL query?
Thanks
Given those rules, shouldn't C be a 'yes' ?
Probably D should be C in the last row. Or there's something missing.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply