title: MySQL - return values based on TOP 5 in different table
body: <p>trying to build dynamic link where TOP 5 from other table will drive the results (below example based on Top 1 to reduce the length of the code). <strong>The main issue is that I can not use LIMIT command.</strong>
  I have this table </p>
  
  <pre><code>CREATE TABLE work1
  (
  wo int (5),
  duration int (5));
  
  insert into work1 values 
  ( 1 ,30),
  ( 2 ,45),
  ( 3 ,30),
  ( 4 ,40),
  ( 5 ,60),
  ( 6 ,80),
  ( 7 ,11);
  </code></pre>
  
  <p>and this one</p>
  
  <pre><code>CREATE TABLE part1
  (
  part VARCHAR (5),
  wo int (5));
  
  insert into part1 values 
  ("A" ,1),
  ('A' ,2),
  ('A' ,3),
  ('A' ,4),
  ('A' ,5),
  ('B' ,6),
  ('B' ,7),
  ('C' ,8),
  ('C' ,9),
  ('D' ,10);
  </code></pre>
  
  <p>My results are basically top 1 Count(part) from part1 with wo and duration from work1 table.</p>
  
  <p>In this case part A is at the top with count of 5 and the results I am after is as per below:</p>
  
  <pre><code>wo  part    duration
  1   A       30
  2   A       45
  3   A       30
  4   A       40
  5   A       60
  </code></pre>