It is necessary to count the number of lines in the rec_id branch with a value of, for example, 1 and output this value to ' print() '

  • one
    SELECT COUNT(rec_id) from ТАБЛИЦА where rec_id='1' - LamerXaKer
  • and if you still need to sum up the values ​​of the 'voice' branch where rec_id = 1? - Kill Noise
  • Change COUNT (rec_id) to COUNT (voice) - Riĥard Brugekĥaim
  • @ RiĥardBrugekĥaim is not only COUNT (voice) but SUM (voice) when it comes to the amount - Batanichek
  • SUM (voice) he will count the entire branch, and you only need to read the lines where rec_id = 1 - Kill Noise

1 answer 1

To count the number of rows, use the COUNT () method:

SELECT COUNT(rec_id) from ТАБЛИЦА where rec_id='1'

To get the amount, you can use the SUM () method:

SELECT SUM(voice) from ТАБЛИЦА where rec_id='1'