sql - SSRS Visual Studio 2008 - How to compare name to pipe delimited list of names? -


i new sql. trying count of activities done specified people in persons table.

pseudo sql query:

select count activities table  left outer join persons table p p.lastname + ', ' + p.firstname 'lastname1, firstname1 | lastname2, firstname2 |..." 

what way compare names in persons table pipe delimited list of names passed parameter in ssrs report?

probably looking this:

total of activities persons of interest

select count(*) activities_count   activites left join        persons p on a.person_id = p.id  'lee, mark | doe, jhon' '%' + p.lastname + ', ' + p.firstname + '%' 

number of activities per person

select p.id, count(*) activities_count   activites left join        persons p on a.person_id = p.id  'lee, mark | doe, jhon' '%' + p.lastname + ', ' + p.firstname + '%'  group p.id 

here sqlfiddle


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -