Comparing Salary among Arrays()

Asked

Viewed 24 times

1

I have the following Query:

SELECT * FROM folhapagamento_storages WHERE idFolhaParametro = '1' AND valor_min >= '1083.4' AND valor_max <= '1083.4'

Only that the return will always be 0, what would be doing wrong? What would be the correct logic?

In this case, you would need to return only track 1, as result, and come zeroed...

2 answers

3

SELECT * FROM folhapagamento_storages WHERE idFolhaParametro = 1 AND valor_min >= 1083.4 AND valor_max <= 1083.4

<=

You have to put <= (equal) in the consultation of the valor_max. And decimal number doesn’t need quotes.

  • 1

    Similarly, the result is zero, in this condition

  • Looking better now your records really will not return anything to that your query. No minimum or maximum value adheres to your condition. Now, if you put one OR in place of AND between the values will return records.

0

You are referring using: value_max = '1083.4'. The correct would be <= '1083.4'.

Full query:

SELECT * FROM folhapagamento_storages WHERE idFolhaParametro = '1' AND valor_min >= '1083.4' AND valor_max <= '1083.4'

Browser other questions tagged

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