Answer the question
In order to leave comments, you need to log in
How to make a selection with the addition of a field and its value by condition?
There is a table from several fields. I have a request that looks like this:
SELECT id,fd,date,sum(sum) as spending FROM `spending` GROUP BY fd
Answer the question
In order to leave comments, you need to log in
COUNT(`product_id`) != COUNT(*) AS `is_empty`
And why do you need a selection of `id` and `date`? MySQL, of course, allows such a departure from the standard, but think about which line, which fell into the group by `fd`, should the values of these fields be selected from?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question