Re: matching people with projects via resources

2004-10-01 Thread SGreen
It's not as elegant as I wanted I got it to work this way (I must be getting tired) create temporary table projects_need SELECT proj , count(rsrc) as rsrc_count FROM project group by proj; CREATE temporary table suppliers_match select p.proj , s.name , count(s.name) a

RE: matching people with projects via resources

2004-10-01 Thread Gordon
This may not be elegant, but why not define a 3rd table proj_c containing proj and project_rsrc. This assumes that when you define a project you know how many resources are required. CREATE TABLE proj_c ( proj varchar(11) default NULL, project_rsrc INT default 0); INSERT INTO proj_c VALU

Re: matching people with projects via resources

2004-10-01 Thread Matt Eaton
Hi Laszlo, This is sort of a butchery, and might be a little nicer with two queries and a temp table, but this works in mysql 4.1.3-beta (at least, it did for me). SELECT A.name, B.proj FROM people as A, project as B WHERE A.rsrc=B.rsrc GROUP BY A.name, B.proj HAVING COUNT(*)=(SELECT COUNT(*) FR