I can't quite get my head around this one so I need some advice please.

I have a number of products to which I have assigned some keywords using separate tables. I would like to iterate through those keywords and produce a list of other products that contain the same keyword... So in the example below I have a product with the ID of 149 that has two keywords assigned to it, however my SQL will only work on a product with one keyword.

So the bit I can't quite get my head around is how I can produce a list of products utilising both keywords. Any help would be great.

SQL:-

```
 $products_id = $_GET['products_id'];
 $slideQuery = mysql_query("

 select p.products_id, p.products_image, p.products_price, 
 pd.products_name, k2p.key_key_id  

 from products p

 join products_description pd on 
 pd.products_id = p.products_id 

 join products_keyword_to_product k2p on 
 k2p.products_id = p.products_id 

 where k2p.key_key_id = (
      select key_key_id  
  from
  products_keyword_to_product
  where 
  products_id=" . $products_id ."
      )  

  group by p.products_id 
  order by p.products_price desc 
  limit 12

```

Edit to add: I have achieved this before by using a php while loop and querying the database within this loop, but I'm convinced that there has to be a better way of doing this.

Update: I looked into the suggestions I received from this question and could never quite get my query to work. At this point it's a little beyond my 'pay grade' so I chose to create a link that would pass the relevant IDs into the URL string and re-load the page which as the site grows will probably turn out to be the better option anyway.
I think the lesson learned here is to step back from what you're trying to achieve and ensure that the way you are doing it is the best way to achieve it.