Nate Pet
Nate Pet

Reputation: 46222

SQL Select Distinct with multiple columns

I have the following select statement which works fine (using SQL Server 2012) :

SELECT distinct(Department) FROM Projects

But when I try the following:

SELECT 'January', distinct(Department) FROM Projects

I get an error message that I could not understand what was next to (

I tried the group by as well but did not seem to work:

SELECT 'January' mm, distinct(Department)
FROM Projects
GROUP BY mm 

Upvotes: 0

Views: 110

Answers (1)

LHA
LHA

Reputation: 9645

Try this:

SELECT DISTINCT department, 'January' mm FROM projects

One note: You should uppercase SQL keywords.

Upvotes: 1

Related Questions