$results = db_query('SELECT code.countrycode, content.countryname, content.countrylanguage, content.featurephotocaption, content.historicphotocaption, content.firstparagraph, content.maincontent FROM {code} code INNER JOIN {content} content ON code.nid = content.pnid WHERE code.nid = %d', $node->nid); while($data = db_fetch_array($results)) { // code here }