Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Counting one of multiple rows with same value for same ID

MilosCApr 28 2015 — edited Apr 29 2015

Hello,

I have this query:

SELECT

count( case when EXISTS (

            SELECT *

            FROM  business_log bl, subject su

            WHERE  su.ID_SUBJECT = s.ID_SUBJECT

            and bl.id_subject = su.id_subject

            AND    bl.value = 'Solved'

            )

then 1 else null end) num_solved

FROM subject s

It is posible that one subject is more than once 'Solved' in table BUSINESS_LOG

I want to count only one row solved for one subject.

I must to use only SUBJECT table in the main query because of other counts.

Thank You very much.

Regards

Milos

Message was edited by: 2796614

This post has been answered by RogerT on Apr 28 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 27 2015
Added on Apr 28 2015
26 comments
6,784 views