I'm trying using this code to show last node with a specific term. Don't know what's wrong with this one.

<?php
/* list of recent posts of node type 'page'
** output in descending chronological order
*/
unset ($output5); // clear previous output
$node_type = "noticia";
$list_no = 5;
$taxo_id = 21;
$sql = "SELECT node.title, node.type, node.nid FROM {node} INNER JOIN term_node ON n.nid = term_node.nid WHERE node.type = '$node_type' AND term_node.tid = $taxo_id AND node.status = 1 ORDER BY node.created DESC LIMIT $list_no";
$output5 .= "<h5><strong>Noticias</strong></h5>";
$output5 .= "<div></div>";
$output5 .= "<ul>";
$result5 = db_query($sql);
while ($anode = db_fetch_object($result5)) {
$output5 .= "<p>";
$output5 .= "<li>".l($anode->title, "node/$anode->nid")."</li>";
$output5 .= "</p>";
};
$output .= "</ul>";
print $output5;
?>