title: mysql: find newest non null values
body: <p>I have a huge table with 100 fields. Each row is timestamped. I want to find the latest non null value for all columns. I'm using MySql 5.6 InnoDB</p>
  
  <p>e.g.</p>
  
  <pre><code>create table tester(
  pub_id int,
  pub_name varchar(20),
  pub_city varchar(20),
  country varchar(20),
  no_of_branch varchar(20),
  estd datetime
  );
  
  
  insert into tester (pub_id, pub_name, pub_city, country, estd)
  values 
  (1,  'a', 'xyz', 'abcity' , 'a', '1970-01-01 00:00:01'),
  (2,  'a', 'xyz', ''       , 'a', '1971-01-01 00:00:01'),
  (3,  'a', 'xyz', 'abcity1', 'b', '1972-01-01 00:00:01'),
  (4,  'a', 'xyz', ''       , 'a', '1973-01-01 00:00:01'),
  (5,  'a', 'xyz', 'abcity2', '' , '1974-01-01 00:00:01'),
  (6,  'b', 'lmn', 'abcity' , 'a', '1974-01-01 00:00:01'),
  (7,  'b', 'xyz', ''       , 'a', '1975-01-01 00:00:01'),
  (8,  'b', 'sdf', 'abcity1', 'b', '1976-01-01 00:00:01'),
  (9,  'b', ''   , ''       , 'a', '1977-01-01 00:00:01'),
  (10, 'b', ''   , 'abcity2', '' , '1978-01-01 00:00:01');
  </code></pre>
  
  <p>I want to query that would give me:</p>
  
  <pre><code>'a', 'xyz', 'abcity2', 'a'
  'b', 'sdf', 'abcity2', 'b'
  </code></pre>
  
  <p>I don't want to use a query where i find empty values for each column of the table individually and then take a join as this would be a very cumbersome task given that my actual table has 100 columns.</p>
  
  <p>I have searched for a solution for the past of couple of ours and found nothing. ANy help would be greatly appreciated.</p>
  
  <p>Thanks</p>