How to add a value in an empty field in Mysql?

Asked

Viewed 116 times

0

I’m spinning a query who needs to pick up the 5 first lines with limit 5. However, there are times when they will return less than 5 lines. The value comes empty, nor NULL, nor 0.

I try to make a case when, but keeps returning empty. Does anyone know how I can solve this?

My query this below:

select case when defail5  then 0 else defail5 end 
  from (select failure, count(failure) as defail5 
          from reparo.falhas_consolidadas 
         where  brand2 in ('LBG_DKT') 
           and week = 'week-5-16' 
         group by failure 
         order by count(failure) desc limit 4 offset 3) as tb1;
  • You can’t handle it on your show?

  • Which field is empty? Try to explain your question better.

  • everything comes empty,

  • Diego, just to better understand, the query always has to return 5 lines, is that it? When you have only 3 lines you have to return two more lines with value 0? Try to put an example of what you expect to return in your query in these situations.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.