multiple queries in select sql $result = db_query("SELECT {node}.title, {content_type_answer}.field_question_nid, {content_type_answer}.nid FROM {node}, {content_type_answer} ORDER by nid ASC LIMIT %d, %d", 0, 3);
while($ref = db_fetch_object($otvet)) {
    $otvets[] = array($ref-&gt;field_question_nid, $ref-&gt;nid, $ref-&gt;title);
}


I have 2 content types: 1. question, 2. answer.
In {content_type_answer} i have a nodereference field - field_question_nid that gives me the node id of the referenced question and {content_type_answer}.nid - gives me the answer node id.

But the problem is in title, {content_type_answer} table doesn't has a title row. In a code above i've succesfully selected title row from {node} table :D But how to make condition - i need only {node}.title from nodes which have {content_type_answer}.nid?
This is a job for Views.  To expound upon the comments, this is a screen shot of a quick view that will do this:



I created two quick content types, answer and question.  I used the body field just for expediency in both, and the only other field I added was a node reference called question in the answer type.

In the View, I filted on published nodes of type answer, the argument is that node reference field above, with the default coming from the URL.  I output the Title and Body field.  I set the paging options to 4 so that it would output a maximum of 4 answers to match the LIMIT in your query.  I didn't sort the output but you can do that if you want in Sort Criteria.

I created only one quick question and answer.  On my system, the question is nid 379, so:

 

putting that in as the argument, the view will output any answers (well, up to 4) with that nid as the node reference in question.  Create a block display for this, and you can have this displayed on your node page with the question.

Now, as you mention in the comments, if you are sure you want to do all of this yourself in your page.tpl.php file with db_query()s, feel free to scrape out the query Views has built for you from the preview.  In this case, that would be:

SELECT node.title AS node_title, node.nid AS nid, node_revisions.body AS node_revisions_body, node_revisions.format AS node_revisions_format FROM node node  LEFT JOIN content_type_answer node_data_field_question ON node.vid = node_data_field_question.vid LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid WHERE (node.status = 1) AND (node.type in ('answer')) AND (node_data_field_question.field_question_nid = 379 )


and modify it to your specific needs.