mysql - Find all employee who have worked on at least two projects -


table: projectressources

idproject  idemployee  numhours   priceperhr 1          1876       500        65 1          4354       2000       31 2          2231       250        55 3          2231       500        65 3          1212       3000       35 3          1876       2000       35 

i come following research syntax can't figure how filter indicate 2231 , 1876:

select idemployee, count (*) ‘number of projects’ projectressources group idemployee; 

you're headed in right direction. missing piece having clause allows filter aggregate expression, such count(*):

select   idemployee, count (*) ‘number of projects’      projectressources group idemployee having   count(*) > 1 -- here! 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -