Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)

  • RE: sql query count function

    Thanks all, for your post and comments. Very helpful.

    I figured it out / Solution:

    select t.topic_key, t.topic_name,

    COUNT(CASE WHEN

    uel.event_id='1'

    and u.intent_id = '2'

    THEN u.user_id END) AS numCouldHelp,

    COUNT(CASE WHEN

    uel.event_id='1'

    and u.expertise_id != '1'

    THEN u.user_id END)...

  • RE: sql query count function

    My mistake !! Sorry about that...goggled search "SQL query" and got mixed up with SQL Server !

  • RE: sql query count function

    It's MySQL !!

  • RE: sql query count function

    Thank you ,

    select abc = count(u.user_id CASE

    WHEN

    u.topic_id = '95'

    and uel.event_id='1'

    and u.intent_id = '2'

    THEN 1 ELSE 0 END),

    def = count(u.user_id CASE

    WHEN

    u.topic_id = '95'

    and uel.event_id='1'

    and u.expertise_id != '2'

    THEN 1 ELSE 0 END)

    FROM

    topic...

  • RE: sql query count function

    I am trying to use the count function twice on the same attribute

    count(u.user_id) but with different conditions on the same tables.

    Is there another way around ?

    Thanks!

  • RE: sql query count function

    Thank you all for your responses.

    I tried to simplify the problem into a table but this is my actual query where I am stuck:

    select numInterested = (count(u.user_id)

    ...

Viewing 6 posts - 1 through 6 (of 6 total)