My table structures are :
table1 :
id      |    title    |    category    | body
--------+-------------+----------------+---------------
1       | blah blah   | 2              | blah blah blah
2       | blah blah   | 3              | blah blah blah
3       | blah blah   | 2              | blah blah blah
4       | blah blah   | 1              | blah blah blah
table2 :
id      |   cid    |   type    |     link
--------+----------+-----------+--------------------
1       | 1        | c1        | http://........
1       | 2        | c1        | http://........
1       | 3        | c1        | http://........
1       | 4        | c1        | http://........
1       | 2        | c2        | http://........
1       | 3        | c2        | http://........
1       | 1        | c2        | http://........
Now I use this code to select from this tables in 3 separate queries :
$query = mysql_select("SELECT * FROM table1");
while ($result = mysql_fetch_array($query)) {
   $c1 = mysql_fetch_array(mysql_query("SELECT link FROM table2 WHERE cid=".$result['id']." AND type = 'c1' ORDER BY id DESC LIMIT 1"));
   $c2 = mysql_fetch_array(mysql_query("SELECT link FROM table2 WHERE cid=".$result['category']." AND type = 'c2' ORDER BY id DESC LIMIT 1"));
  ....
}
Is it possible to write these queries in one query for mysql ?
 
    