If you're using TSQLQuery, which is a TCustomBufDataset descendent, the solution is quite simple: create an OnFilterRecord for the Query, then:
procedure TForm1.SQLQuery1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
begin
Accept := SQLQuery1.FieldByName('FIRSTNAME').AsString = 'John';
end;
The code is self explanatory I guess, if not please let us know.