selecting duplicate values with a condition from a mysql table I have the following table in mysql:

   Key    DI     CI     FD      FA  NM  Valid_from   Valid_to
    0   1224468 123 2012-06-30  3   6   2013-01-23  9999-12-31
    1   1234567 123 2013-12-31  3   10  2014-02-27  2014-03-10
    2   1234567 123 2013-12-31  2   12  2014-03-10  9999-12-31
    3   1234579 123 2013-12-31  3   12  2014-05-15  9999-12-31
    4   1234595 123 2013-12-31  1   12  2014-06-30  9999-12-31
    5   122469  123 2015-11-11  1   6   2015-11-11  9999-12-31
    6   1224470 123 2015-11-11  2   12  2015-11-11  9999-12-31
    7   1224471 123 2015-11-11  3   15  2015-11-11  9999-12-31
    8   1224472 123 2015-11-10  2   13  2015-11-10  9999-12-31
    9   1224473 123 2015-11-10  3   12  2015-11-10  9999-12-31


If there are records which has the same "FD", I need to get the ones which 's "FA" is "1", if exists.

Basically, I want this output.

  Key   DI     CI     FD      FA  NM  Valid_from   Valid_to
   0  1224468 123 2012-06-30  3   6   2013-01-23  9999-12-31
   4  1234595 123 2013-12-31  1   12  2014-06-30  9999-12-31
   5  122469  123 2015-11-11  1   6   2015-11-11  9999-12-31
   8  1224472 123 2015-11-10  2   13  2015-11-10  9999-12-31
   9  1224473 123 2015-11-10  3   12  2015-11-10  9999-12-31


It looks a complicated query, and I couldn't manage to do it.

How can I do it?
select * from Table1 t
where not exists(
  select 1 from Table1 p where p.FD = t.FD
      and p.FA != t.FA and p.FA = 1
);


Or as a LEFT JOIN (might be better optimized on 5.5)

select t.* from Table1 t
left join Table1 p on p.FD = t.FD
      and p.FA != t.FA and p.FA = 1
where p.`Key` is null;


http://sqlfiddle.com/#!9/39664/4