MYSQL returns OK

Asked

Viewed 69 times

0

Good evening friends,

Can anyone tell me why the query below returns OK?

SELECT Count(*) as Dias_uteis FROM Owner.dias_uteis d WHERE d.data_util BETWEEN (select ts.creatión from Owner.tabela ts Where ts.chamado in('1455678','1459783') group by ts.chamado) AND now()

I need to count to how many days a call was opened if I step only one condition the counter works. However when I search more than one called mysql returns only OK and nothing to view.

  • 1

    Note that your subselect can return multiple dates and not just one.

  • This sql runs !? Returns "ok" in a "Count" !?

1 answer

0

I agree with the comment regarding the return of more than one date in the subselect, and for the call count to be made, which I believe is the goal, I think you should refer to the working day table in the subselect:

select 
  ts.chamado,
  (
    SELECT count(*) FROM owner.dias_uteis d 
    WHERE d.data_util BETWEEN ts.criacao AND now()
  ) as Dias_uteis
from owner.tabela ts 
where ts.chamado in ('1455678', '1459783') 
group by ts.chamado

I hope it helps

Browser other questions tagged

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