S
S
snake22022-03-05 15:12:21
MySQL
snake2, 2022-03-05 15:12:21

Is it possible to make a counter in sql?

mysql subd
->selectRaw('SUM(if(users = 1,sum - minus, null)) as msk,
if(users = 1,COUNT(id), null) as count_msk')

->selectRaw('SUM(if (users2 = 1,sum2 - minus2, null)) as msk,
if(users2 = 1,COUNT(id), null) as count_msk')

Is it possible to count how many times the first one was executed and how many times the second one, i.e. how many users = 1, how much is 2?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question