This is more complicated than you think because you are trying to return 2 different datasets from the same query - most RDBMS systems do not like this. The datatype of each column must always be the same, and the number of columns needs to be the same. What you are trying to do is really better suited to the application layer.
That being said, here is a version that is close to what you ask. I have written it using SQL Server but the actual query itself uses standard SQL. First I will make a table variable with some sample data.
DECLARE @Data TABLE (project_id INT);
-- fill the table with all unqiue values
INSERT INTO @Data(project_id) VALUES (1), (2), (3);
SELECT
CASE WHEN COUNT(DISTINCT project_id) = COUNT(project_id) THEN CAST(project_id AS VARCHAR)
ELSE CONCAT(project_id, ' is not unique') END AS [ID]
FROM @Data
GROUP BY project_id;
The output of this looks like:
|ID|
|--|
|1|
|2|
|3|
Now let's look at a version where there are duplicate values:
DECLARE @Data TABLE (project_id INT);
-- fill the table with all unqiue values
INSERT INTO @Data(project_id) VALUES (1), (2), (3);
-- add duplicate values
INSERT INTO @Data(project_id) VALUES (1), (3);
SELECT
CASE WHEN COUNT(DISTINCT project_id) = COUNT(project_id) THEN CAST(project_id AS VARCHAR)
ELSE CONCAT(project_id, ' is not unique') END AS [ID]
FROM @Data
GROUP BY project_id;
And the output looks like:
ID |
1 is not unique |
2 |
3 is not unique |
Again, this isn't exactly what you asked for, but I am not 100% sure that what you are asking can be accomplished in SQL alone.