R
R
RaTeNs2017-08-17 00:07:30
MySQL
RaTeNs, 2017-08-17 00:07:30

How to select as many rows from the database, the value of the sum of the columns of which is less than the variable?

Hello, is it possible to write a query to select only the number of rows, the sum of cell values ​​of a certain column was less than a certain value?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vbif, 2018-09-27
@vbif

Perhaps something like this:

select T1.* from
  TABLE T1
  inner join TABLE T2 on T2.ID<=T1.ID
group by T1...
having sum(T2.TARGET_VALUE)< [значение, с которым нужно сравнить]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question