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

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -