-3

I have a table with the name and date added.

How do I make a request so that the output contains names, the number of unique names,the minimum and maximum date of addition.

Here you get only the total number - I need for each unique name.

SELECT COUNT(namesh) AS count1
     , MAX(dates) AS maxx
     , MIN (dates) AS minn 
  FROM testtable11 
 WHERE namesh IS NOT NULL

When I add the namesh to SELECT I get "not a single-group group function"

Shadow
  • 33,525
  • 10
  • 51
  • 64
azamat303
  • 3
  • 1
  • 2

1 Answers1

0

You need to add Group BY namesh to your query:

SELECT COUNT(namesh) AS count1, MAX(dates) AS maxx, MIN(dates) AS minn 
FROM testtable11 
WHERE namesh IS NOT NULL
GROUP BY namesh

not a single-group group function error occurs when a query has an aggregate function (e.g. COUNT, MIN, MAX, SUM, or AVG) as well as other fields or statements, but there is no GROUP BY clause.