How to add where clause to custom Drupal view I am fetching data from two table to my view using View API. How can I add where clause to my view?

My actual SQL query is like:

select field1,field2,field3,t2field4 from table1,table2 where t2field=field1


I come across hook_view_alter() but I dont know how to implement that.
Can I use any filter handler in my views.inc file?
You can implement hook_view_query_alter() to add where condition.

function MODULE_NAME_views_query_alter(&amp;$view, &amp;$query) {
  if ($view-&gt;name == 'view_name') {
    $query-&gt;add_where(1,'node.nid',$value,'=');  
  }
}